Class: Jenkins2::CLI::OfflineNode

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



126
127
128
129
# File 'lib/jenkins2/cli/nodes.rb', line 126

def self.description
	'Stop using a node for performing builds temporarily, until the next "online-node" '\
	'command.'
end

Instance Method Details

#add_optionsObject



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/jenkins2/cli/nodes.rb', line 131

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '-n', '--name NAME', 'Name of the node or "(master)" for master.' do |n|
		options[:name] = n
	end
	parser.separator 'Optional arguments:'
	parser.on '-m', '--message TEXT', 'Record the reason about why you are disconnecting the'\
		' node.' do |m|
		options[:message] = m
	end
end

#runObject



143
144
145
146
# File 'lib/jenkins2/cli/nodes.rb', line 143

def run
	return if jc.computer(options[:name]).temporarilyOffline
	jc.computer(options[:name]).toggle_offline(options[:message])
end