Class: Jenkins2::CLI::WaitNodeOffline

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



186
187
188
# File 'lib/jenkins2/cli/nodes.rb', line 186

def self.description
	'Wait for a node to become offline.'
end

Instance Method Details

#add_optionsObject



190
191
192
193
194
195
196
197
198
199
200
# File 'lib/jenkins2/cli/nodes.rb', line 190

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '-n', '--name NAME', 'Name of the node.' do |n|
		options[:name] = n
	end
	parser.separator 'Optional arguments:'
	parser.on '-w', '--wait MINUTES', Integer, 'Maximum number of minutes to wait. Default is '\
		'60.' do |w|
		options[:wait] = w
	end
end

#runObject



202
203
204
205
206
# File 'lib/jenkins2/cli/nodes.rb', line 202

def run
	Jenkins2::Util.wait(max_wait_minutes: options[:wait]) do
		!jc.computer(options[:name]).online?
	end
end