Class: OpscodeAcl::AclShow

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/acl_show.rb

Instance Method Summary collapse

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/knife/acl_show.rb', line 29

def run
  object_type, object_name = name_args

  if name_args.length != 2
    show_usage
    ui.fatal "You must specify an object type and object name"
    exit 1
  end

  validate_object_type!(object_type)
  validate_object_name!(object_name)
  acl = get_acl(object_type, object_name)
  PERM_TYPES.each do |perm|
    # Filter out the actors field if we have
    # users and clients.  Note that if one is present,
    # both will be - but we're checking both for completeness.
    if acl[perm].key?("users") && acl[perm].key?("clients")
      acl[perm].delete "actors"
    end
  end
  ui.output acl
end