Class: KubesGoogle::Secrets::Fetcher::Gcloud
- Inherits:
-
Base
- Object
- Base
- KubesGoogle::Secrets::Fetcher::Gcloud
show all
- Includes:
- Util::Sh
- Defined in:
- lib/kubes_google/secrets/fetcher/gcloud.rb
Instance Method Summary
collapse
Methods inherited from Base
#base64?, #initialize
Methods included from Logging
#logger
Instance Method Details
#fetch(short_name, version = "latest") ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/kubes_google/secrets/fetcher/gcloud.rb', line 5
def fetch(short_name, version="latest")
value = gcloud("secrets versions access #{version} --secret #{short_name}")
if value.include?("ERROR") && value.include?("NOT_FOUND")
logger.info "WARN: secret #{short_name} not found".color(:yellow)
logger.info e.message
"NOT FOUND #{short_name}" else
value = Base64.strict_encode64(value).strip if base64?
value
end
end
|
#gcloud(args) ⇒ Object
17
18
19
|
# File 'lib/kubes_google/secrets/fetcher/gcloud.rb', line 17
def gcloud(args)
capture("gcloud --project #{@project_id} #{args}")
end
|