lib/core/controlplane.rb in cpl-1.1.2 vs lib/core/controlplane.rb in cpl-1.2.0
- old
+ new
@@ -21,13 +21,14 @@
cmd = "cpln profile get #{profile} -o yaml"
perform_yaml(cmd).length.positive?
end
def profile_create(profile, token)
+ sensitive_data_pattern = /(?<=--token )(\S+)/
cmd = "cpln profile create #{profile} --token #{token}"
cmd += " > /dev/null" if Shell.should_hide_output?
- perform!(cmd)
+ perform!(cmd, sensitive_data_pattern: sensitive_data_pattern)
end
def profile_delete(profile)
cmd = "cpln profile delete #{profile}"
cmd += " > /dev/null" if Shell.should_hide_output?
@@ -45,10 +46,11 @@
def image_build(image, dockerfile:, build_args: [], push: true)
# https://docs.controlplane.com/guides/push-image#step-2
# Might need to use `docker buildx build` if compatiblitity issues arise
cmd = "docker build --platform=linux/amd64 -t #{image} -f #{dockerfile}"
+ cmd += " --progress=plain" if ControlplaneApiDirect.trace
build_args.each { |build_arg| cmd += " --build-arg #{build_arg}" }
cmd += " #{config.app_dir}"
perform!(cmd)
@@ -232,10 +234,20 @@
cmd += " --container #{container}" if container
cmd += " -- #{command}"
perform!(cmd)
end
+ # volumeset
+
+ def fetch_volumesets(a_gvc = gvc)
+ api.list_volumesets(org: org, gvc: a_gvc)
+ end
+
+ def delete_volumeset(volumeset, a_gvc = gvc)
+ api.delete_volumeset(org: org, gvc: a_gvc, volumeset: volumeset)
+ end
+
# domain
def find_domain_route(data)
port = data["spec"]["ports"].find { |current_port| current_port["number"] == 80 || current_port["number"] == 443 }
return nil if port.nil? || port["routes"].nil?
@@ -344,11 +356,11 @@
Shell.debug("CMD", cmd)
system(cmd)
end
- def perform!(cmd)
- Shell.debug("CMD", cmd)
+ def perform!(cmd, sensitive_data_pattern: nil)
+ Shell.debug("CMD", cmd, sensitive_data_pattern: sensitive_data_pattern)
system(cmd) || exit(false)
end
def perform_yaml(cmd)