Class: Jenkins2::CLI::DeleteNode

Inherits:
Jenkins2::CLI show all
Defined in:
lib/jenkins2/cli/nodes.rb

Instance Attribute Summary

Attributes inherited from Jenkins2::CLI

#errors, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jenkins2::CLI

#call, class_to_command, #initialize, #parse, subcommands

Constructor Details

This class inherits a constructor from Jenkins2::CLI

Class Method Details

.descriptionObject



44
45
46
# File 'lib/jenkins2/cli/nodes.rb', line 44

def self.description
	'Delete node(s).'
end

Instance Method Details

#add_optionsObject



48
49
50
51
52
53
# File 'lib/jenkins2/cli/nodes.rb', line 48

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '-n', '--name X,Y,..', Array, 'Names of nodes to delete.' do |n|
		options[:name] = n
	end
end

#runObject



55
56
57
58
59
# File 'lib/jenkins2/cli/nodes.rb', line 55

def run
	options[:name].all? do |name|
		jc.computer(name).delete
	end
end