Method: Rundeck::Client::Key#key_contents
- Defined in:
- lib/rundeck/client/key.rb
#key_contents(path, options = {}) ⇒ Rundeck::ObjectifiedHash
Get the contents of a key. Only allowed for public keys. Note: This method returns a raw string of the public key, not at ObjectifiedHash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/rundeck/client/key.rb', line 68 def key_contents(path, = {}) # Check if key exists first. Otherwise we could return some # weird strings. Also, raise error if user is trying to get a # private key. key_content_type = (path, ).rundeck_content_type if key_content_type == content_type('private') fail Error::Unauthorized, 'You are not allowed to retrieve the contents of a private key' end .merge!(format: :plain, headers: { 'Accept' => 'application/pgp-keys' }) key = get("#{STORAGE_KEYS_PATH}/#{path}", ) objectify 'public_key' => key end |