Sha256: 604140c82461aab1e9ec661bcd93d8070991a1a6e0002c9db073c9d2b90c615b

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

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

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

  desc "Create a new host"
  arg_name "host"
  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

4 entries across 4 versions & 1 rubygems

Version Path
conjur-cli-2.4.1 lib/conjur/command/hosts.rb
conjur-cli-2.4.0 lib/conjur/command/hosts.rb
conjur-cli-2.3.0 lib/conjur/command/hosts.rb
conjur-cli-2.2.1 lib/conjur/command/hosts.rb