Class: Conjur::Command::Layers

Inherits:
Conjur::Command
  • Object
show all
Defined in:
lib/conjur/command/layers.rb

Class Method Summary collapse

Class Method Details

.interpret_layer_privilege(privilege) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/conjur/command/layers.rb', line 16

def self.interpret_layer_privilege(privilege)
  case privilege
  when 'execute'
    'use_host'
  when 'update'
    'admin_host'
  else
    exit_now! "Invalid privilege '#{privilege}'. Acceptable values are : execute, update"
  end
end

.parse_layer_permission_args(global_options, options, args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/conjur/command/layers.rb', line 27

def self.parse_layer_permission_args(global_options, options, args)
  id = require_arg(args, "layer")
  role = require_arg(args, "role")
  privilege = require_arg(args, "privilege")
  role_name = interpret_layer_privilege privilege
  [ id, role_name, role ]
end

.require_hostid_arg(args) ⇒ Object

Form an account:kind:hostid from the host argument Or interpret a fully-qualified role id



8
9
10
11
12
13
14
# File 'lib/conjur/command/layers.rb', line 8

def self.require_hostid_arg(args)
  hostid = require_arg(args, 'host')
  if hostid.index(':') == 0
    hostid = [ Conjur::Core::API., 'host', hostid ].join(':')
  end
  hostid
end