lib/core/controlplane.rb in cpl-0.5.1 vs lib/core/controlplane.rb in cpl-0.6.0
- old
+ new
@@ -128,9 +128,15 @@
def workload_get_replicas(workload, location:)
cmd = "cpln workload get-replicas #{workload} #{gvc_org} --location #{location} -o yaml"
perform_yaml(cmd)
end
+ def workload_get_replicas_safely(workload, location:)
+ cmd = "cpln workload get-replicas #{workload} #{gvc_org} --location #{location} -o yaml 2> /dev/null"
+ result = `#{cmd}`
+ $CHILD_STATUS.success? ? YAML.safe_load(result) : nil
+ end
+
def workload_set_image_ref(workload, container:, image:)
cmd = "cpln workload update #{workload} #{gvc_org}"
cmd += " --set spec.containers.#{container}.image=/org/#{config.org}/image/#{image}"
cmd += " > /dev/null" if Shell.tmp_stderr
perform!(cmd)