Class: Chef::Knife::RoleCreate

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

Instance Method Summary collapse

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/knife/role_create.rb', line 37

def run
  @role_name = @name_args[0]

  if @role_name.nil?
    show_usage
    ui.fatal("You must specify a role name")
    exit 1
  end

  role = Chef::Role.new
  role.name(@role_name)
  role.description(config[:description]) if config[:description]
  create_object(role, object_class: Chef::Role)
end