Answers: <p>This compatibility issue was solved for chef14 with the new load format of a provider in a recipe.</p>
  
  <pre><code>deploy_key deploy_key_name do
        provider Chef::ProviderResolver.new(node, find_resource!("deploy_key[github]"), :nothing).resolve
        path "/home/#{current_user}/.ssh"
        credentials({
            :token =&gt; File.read('/root/someid').strip
        })
        repo 'test/test_config'
        owner 'root'
        group 'root'
        mode '0400'
        action :add
    end
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-30T19:42:38.853Z
Answers: 2019-01-30T19:42:38.853Z
Answers: Carlos Catari
Answers: <p>Unfortunately, I wasn't able to get the cookbook working using the ProviderResolver syntax for loading a provider.</p>
  
  <p>However, I did manage to find an updated fork of the cookbook on GitHub that resolves the Chef 13 deprecations here: <a href="https://github.com/alvlapo/cookbook-deploy_key" rel="nofollow noreferrer">https://github.com/alvlapo/cookbook-deploy_key</a></p>
  
  <p>I believe that should circumvent the issue you're seeing.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-31T19:20:49.783Z
Answers: 2019-01-31T19:20:49.783Z
Answers: maniacalshawn
Body: <p>I have a problem during migration of chef-client 12 to chef-client 14 and seems that the old way to load Providers is different in chef14</p>
  
  <p><code>Chef::Provider::DeployKeyGithub</code> cannot be load</p>
  
  <pre><code>    deploy_key deploy_key_name do
          provider Chef::Provider::DeployKeyGithub
          path "/home/#{current_user}/.ssh"
          credentials({
              :token =&gt; File.read('/root/someid').strip
          })
          repo 'test/test_config'
          owner 'root'
          group 'root'
          mode '0400'
          action :add
      end
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>================================================================================
  
  NameError
  ---------
  uninitialized constant Chef::Provider::DeployKeyGithub
  
  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/flume_wrapper/recipes/default.rb:89:in `block in from_file'
    /var/chef/cache/cookbooks/flume_wrapper/recipes/default.rb:88:in `from_file'```
  
  Does anyone knows how is the new way to load a Provider in a recipe for chef14 client?
  </code></pre>
  
Comments: CC BY-SA 4.0
Comments: 2019-01-29T15:38:08.023Z
Comments: deploy_key is not a core Chef resource, you'd better check the cookbook providing this resource, it may not be compatible with chef 14, best way to know would be to try it with chef 13 which should tell deprecations used.
Comments: Tensibai
Comments: CC BY-SA 4.0
Comments: 2019-01-30T19:38:17.257Z
Comments: It was solved using the new format to load a provider in chef14
  `Chef::ProviderResolver.new(node, find_resource!("deploy_key[github]"), :nothing).resolve`
Comments: Carlos Catari
Tags: <chef>
Title: Chef14 Load a provider in a recipe Chef::Provider::DeployKeyGithub
UserDisplayName: Carlos Catari
ThreadText: # Chef14 Load a provider in a recipe Chef::Provider::DeployKeyGithub
  
  (Asked by: username_0 on 2019-01-29)
  
  I have a problem during migration of chef-client 12 to chef-client 14 and seems that the old way to load Providers is different in chef14
  
  `Chef::Provider::DeployKeyGithub` cannot be load
  
  ```
      deploy_key deploy_key_name do
          provider Chef::Provider::DeployKeyGithub
          path "/home/#{current_user}/.ssh"
          credentials({
              :token => File.read('/root/someid').strip
          })
          repo 'test/test_config'
          owner 'root'
          group 'root'
          mode '0400'
          action :add
      end
  
  ```
  
  Error:
  
  ```
  ================================================================================
  
  NameError
  ---------
  uninitialized constant Chef::Provider::DeployKeyGithub
  
  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/flume_wrapper/recipes/default.rb:89:in `block in from_file'
    /var/chef/cache/cookbooks/flume_wrapper/recipes/default.rb:88:in `from_file'```
  
  Does anyone knows how is the new way to load a Provider in a recipe for chef14 client?
  
  ```
  
  **Tags:** chef
  
  > **Comments:**
  > **username_1**: deploy_key is not a core Chef resource, you'd better check the cookbook providing this resource, it may not be compatible with chef 14, best way to know would be to try it with chef 13 which should tell deprecations used.  
  > **username_0**: It was solved using the new format to load a provider in chef14 `Chef::ProviderResolver.new(node, find_resource!("deploy_key[github]"), :nothing).resolve`  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-01-30. Score: 1
  
  This compatibility issue was solved for chef14 with the new load format of a provider in a recipe.
  
  ```
  deploy_key deploy_key_name do
        provider Chef::ProviderResolver.new(node, find_resource!("deploy_key[github]"), :nothing).resolve
        path "/home/#{current_user}/.ssh"
        credentials({
            :token => File.read('/root/someid').strip
        })
        repo 'test/test_config'
        owner 'root'
        group 'root'
        mode '0400'
        action :add
    end
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2019-01-31. Score: 0
  
  Unfortunately, I wasn't able to get the cookbook working using the ProviderResolver syntax for loading a provider.
  
  However, I did manage to find an updated fork of the cookbook on GitHub that resolves the Chef 13 deprecations here: <https://github.com/alvlapo/cookbook-deploy_key>
  
  I believe that should circumvent the issue you're seeing.
  
  
  ---
  
  