Module: GClouder::Resources::Compute::ProjectInfo::SSHKeys::Remote
- Includes:
- GCloud
- Defined in:
- lib/gclouder/resources/compute/project_info/ssh_keys.rb
Class Method Summary collapse
Methods included from GCloud
Methods included from Config::CLIArgs
check, #cli_args, cli_args, included, load, valid_resources
Methods included from Config::Project
Methods included from Helpers
#hash_to_args, included, #module_exists?, #to_arg, #to_deep_merge_hash, #valid_json?
Methods included from Logging
#add, #bad, #change, #debug, #error, #fatal, #good, included, #info, log, loggers, #remove, report, #resource_state, setup, #warn, #warning
Methods included from Shell
Class Method Details
.data ⇒ Object
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/gclouder/resources/compute/project_info/ssh_keys.rb', line 142 def self.data list.map do |line| components = line.split user, type = components[0].split(":") key = components[1] description = components.length >= 2 ? components[2] : components[0] { key: key, type: type, user: user, description: description } end end |
.list ⇒ Object
132 133 134 135 136 137 138 139 140 |
# File 'lib/gclouder/resources/compute/project_info/ssh_keys.rb', line 132 def self.list keys = .dig("items") return [] unless keys return [] if keys.empty? keys.delete_if { |h| h["key"] != "sshKeys" } keys[0]["value"].split("\n").delete_if { |key| key =~ /^gke-/ }.sort end |
.metadata ⇒ Object
153 154 155 |
# File 'lib/gclouder/resources/compute/project_info/ssh_keys.rb', line 153 def self. gcloud("compute project-info describe | jq -r '.commonInstanceMetadata'", force: true) end |