Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fog][DEPRECATION] Passing the public key as the 2nd arg is deprecated, please pass a hash of attributes. #129

Open
martinb3 opened this issue Oct 4, 2015 · 0 comments

Comments

@martinb3
Copy link
Contributor

martinb3 commented Oct 4, 2015

When using the fog_key_pair resource with fog:Rackspace, and the key is being created for the first time, I'm getting the following warning (note the log output is also missing a path, it just ends in "key at..."):

[fog][DEPRECATION] Passing the public key as the 2nd arg is deprecated, please pass a hash of attributes.

    - create example_id_rsa on fog:Rackspace: from local key at 

The resource in question is:

fog_key_pair 'example_id_rsa'

This appears to be coming from fog/lib/fog/rackspace/requests/compute_v2/create_keypair.rb:

        def create_keypair(key_name, attributes = nil)
          key_data = { 'name' => key_name }

          if attributes.is_a?(String)
            Fog::Logger.deprecation "Passing the public key as the 2nd arg is deprecated, please pass a hash of attributes."
            key_data.merge!("public_key" => attributes)
          end

          key_data.merge!(attributes) if attributes.is_a?(Hash)

This is being called from chef-provisioning-fog at lib/chef/provider/fog_key_pair.rb on line 106:

            when 'Rackspace'
              compute.create_keypair(new_resource.name, Cheffish::KeyFormatter.encode(desired_key, :format => :openssh))

What's interesting is that on the Joyent impl. on line 102, the hash key is added:

compute.create_key(name: new_resource.name, key: Cheffish::KeyFormatter.encode(desired_key, :format => :openssh))

Maybe there's a reason for doing it differently?

martinb3 added a commit to martinb3/chef-provisioning-rackspace-example that referenced this issue Oct 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant