module KubeDeployTools::DeployConfigFileUtil
Public Instance Methods
check_and_err(condition, error)
click to toggle source
# File lib/kube_deploy_tools/deploy_config_file/util.rb, line 5 def check_and_err(condition, error) if ! condition Logger.error("Error in configuration #{@filename}") raise ArgumentError, error end end
check_and_warn(condition, warning)
click to toggle source
# File lib/kube_deploy_tools/deploy_config_file/util.rb, line 12 def check_and_warn(condition, warning) if ! condition Logger.warn("Warning in configuration #{@filename}") Logger.warn(warning) end end
load_library(lib)
click to toggle source
# File lib/kube_deploy_tools/deploy_config_file/util.rb, line 19 def load_library(lib) # All paths must be valid accessible gcs paths for the current user. # To modify gcloud identity being used by this process, set # GOOGLE_APPLICATION_CREDENTIALS or sign in with `gcloud auth login` lib_config = nil if lib.start_with?('gs://') Tempfile.open(['gs-kdt-library', '.yaml']) do |t| out = Shellrunner.check_call('gsutil', 'cat', lib) t.write(out) t.flush lib_config = DeployConfigFile.new(t.path) end elsif File.exist?(lib) lib_config = DeployConfigFile.new(lib) else raise "Unsupported or non-existent library: #{lib}" end lib_config end