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.
297 298 299 |
# File 'lib/cute/taktuk.rb', line 297 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.
305 306 307 |
# File 'lib/cute/taktuk.rb', line 305 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.
301 302 303 |
# File 'lib/cute/taktuk.rb', line 301 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.
323 324 325 326 327 328 329 330 |
# File 'lib/cute/taktuk.rb', line 323 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.
309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/cute/taktuk.rb', line 309 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 |