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.
240 241 242 |
# File 'lib/cute/taktuk.rb', line 240 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.
248 249 250 |
# File 'lib/cute/taktuk.rb', line 248 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.
244 245 246 |
# File 'lib/cute/taktuk.rb', line 244 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.
266 267 268 269 270 271 272 273 |
# File 'lib/cute/taktuk.rb', line 266 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.
252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/cute/taktuk.rb', line 252 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 |