Class: Cute::TakTuk::Hostlist Private
- Inherits:
-
Object
- Object
- Cute::TakTuk::Hostlist
- Defined in:
- lib/cute/taktuk.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Generates a taktuk CLI compatible host list
Instance Method Summary collapse
- #exclude(node) ⇒ Object private
- #free ⇒ Object private
-
#initialize(hostlist) ⇒ Hostlist
constructor
private
A new instance of Hostlist.
- #to_a ⇒ Object private
- #to_cmd ⇒ Object private
Constructor Details
#initialize(hostlist) ⇒ Hostlist
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Hostlist.
298 299 300 |
# File 'lib/cute/taktuk.rb', line 298 def initialize(hostlist) @hostlist=hostlist end |
Instance Method Details
#exclude(node) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
306 307 308 |
# File 'lib/cute/taktuk.rb', line 306 def exclude(node) @hostlist.remove(node) if @hostlist.is_a?(Array) end |
#free ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
302 303 304 |
# File 'lib/cute/taktuk.rb', line 302 def free @hostlist = nil end |
#to_a ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
324 325 326 327 328 329 330 331 |
# File 'lib/cute/taktuk.rb', line 324 def to_a if @hostlist.is_a?(Array) @hostlist elsif @hostlist.is_a?(String) raise "Hostfile does not exist" unless File.exist?(@hostlist) File.read(@hostlist).split("\n").uniq end end |
#to_cmd ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/cute/taktuk.rb', line 310 def to_cmd ret = [] if @hostlist.is_a?(Array) @hostlist.each do |host| ret << '-m' ret << host end elsif @hostlist.is_a?(String) ret << '-f' ret << @hostlist end ret end |