lib/core/controlplane.rb in cpl-0.1.0 vs lib/core/controlplane.rb in cpl-0.2.0

- old
+ new

@@ -16,19 +16,28 @@ cmd = "cpln image build --org #{org} --name #{image} --dir #{config.app_dir} --dockerfile #{dockerfile}" cmd += " --push" if push perform(cmd) end - def image_query - cmd = "cpln image query --org #{org} -o yaml --max -1 --prop repository=#{config.app}" + def image_query(app_name = config.app) + cmd = "cpln image query --org #{org} -o yaml --max -1 --prop repository=#{app_name}" perform_yaml(cmd) end def image_delete(image) api.image_delete(org: org, image: image) end # gvc + + def gvc_query(app_name = config.app) + # When `match_if_app_name_starts_with` is `true`, we query for any gvc containing the name, + # otherwise we query for a gvc with the exact name. + op = config.current[:match_if_app_name_starts_with] ? "~" : "=" + + cmd = "cpln gvc query --org #{org} -o yaml --prop name#{op}#{app_name}" + perform_yaml(cmd) + end def gvc_get(a_gvc = gvc) api.gvc_get(gvc: a_gvc, org: org) end