Class: Jenkins2::CLI::UnassignAllRoles
Overview
Provides unassign-all-roles 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
134
135
136
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 134
def self.description
'Unassign all roles from user in role-strategy plugin.'
end
|
Instance Method Details
#add_options ⇒ Object
138
139
140
141
142
143
144
145
146
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 138
def add_options
parser.separator 'Mandatory arguments:'
parser.on '--type TYPE', 'Role type. One of: globalRoles, projectRoles, slaveRoles.' do |t|
options[:type] = t
end
parser.on '--rsuser USER', 'Username.' do |u|
options[:rsuser] = u
end
end
|
#mandatory_arguments ⇒ Object
148
149
150
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 148
def mandatory_arguments
super + %i[type rsuser]
end
|
#run ⇒ Object
152
153
154
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 152
def run
jc.roles.unassign_all(type: options[:type], rsuser: options[:rsuser])
end
|