Class: Jenkins2::CLI::DeleteRoles
Overview
Provides delete-role command in CLI. Requires role-strategy plugin enabled.
Instance Attribute Summary
#errors, #options
Class Method Summary
collapse
Instance Method Summary
collapse
#call, class_to_command, #initialize, #parse, subcommands
Constructor Details
This class inherits a constructor from Jenkins2::CLI
Class Method Details
.description ⇒ Object
53
54
55
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 53
def self.description
'Delete role(s) in role-strategy plugin.'
end
|
Instance Method Details
#add_options ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 57
def add_options
parser.separator 'Mandatory arguments:'
parser.on '--role X,Y,..', Array, 'Role names.' do |r|
options[:role] = r
end
parser.on '--type TYPE', 'Role type. One of: globalRoles, projectRoles, slaveRoles.' do |t|
options[:type] = t
end
end
|
#mandatory_arguments ⇒ Object
67
68
69
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 67
def mandatory_arguments
super + %i[role type]
end
|
#run ⇒ Object
71
72
73
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 71
def run
jc.roles.delete(role: options[:role], type: options[:type])
end
|