Class: Renuo::Cli::Services::Deploio

Inherits:
Object
  • Object
show all
Defined in:
lib/renuo/cli/services/deploio.rb

Class Method Summary collapse

Class Method Details

.fetch_appsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/renuo/cli/services/deploio.rb', line 5

def fetch_apps
  fetch_apps_cmd = %(nctl get apps -A -o yaml)
  stdout, stderr, status = Open3.capture3 fetch_apps_cmd
  raise "Error fetching Deploio app list: #{stderr}" unless status.success?

  YAML.load_stream(stdout).map do |app|
    name = app.dig("metadata", "name")
    namespace = app.dig("metadata", "namespace")
    spec_hosts = app.dig("spec", "forProvider", "hosts") || []

    { name: name, namespace: namespace, hosts: spec_hosts }
  end
end