Sha256: cb36765f20c76526c7c310969763ae5c76e4bb8e7de50b6ceabb005736b832f6

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

require 'conjur/authn'
require 'conjur/command'

class Conjur::Command::Hosts < Conjur::Command
  self.prefix = :host

  desc "Create a new host"
  arg_name "id?"
  command :create do |c|
    c.arg_name "password"
    c.flag [:p,:password]
    
    acting_as_option(c)

    c.action do |global_options,options,args|
      id = args.shift
      options[:id] = id if id
      display api.create_host(options), options
    end
  end
  
  desc "Enroll a new host into conjur"
  arg_name "host"
  command :enroll do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'host')
      enrollment_url = api.host(id).enrollment_url
      puts enrollment_url
      $stderr.puts "On the target host, please execute the following command:"
      $stderr.puts "curl -L #{enrollment_url} | bash"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-cli-2.6.0 lib/conjur/command/hosts.rb