Class: Hostlist
- Inherits:
-
Object
- Object
- Hostlist
- Defined in:
- lib/mofa/hostlist.rb
Instance Attribute Summary collapse
-
#concrete_target ⇒ Object
Returns the value of attribute concrete_target.
-
#list ⇒ Object
Returns the value of attribute list.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#concrete_target ⇒ Object
Returns the value of attribute concrete_target.
7 8 9 |
# File 'lib/mofa/hostlist.rb', line 7 def concrete_target @concrete_target end |
#list ⇒ Object
Returns the value of attribute list.
6 7 8 |
# File 'lib/mofa/hostlist.rb', line 6 def list @list end |
Class Method Details
.create(concrete_target) ⇒ Object
9 10 11 12 13 |
# File 'lib/mofa/hostlist.rb', line 9 def self.create(concrete_target) hl = Hostlist.new hl.concrete_target = concrete_target hl end |
.get_role(hostname) ⇒ Object
19 20 21 |
# File 'lib/mofa/hostlist.rb', line 19 def self.get_role(hostname) Hostlist::get_shortname(hostname).gsub(/\d+$/, '') end |
.get_shortname(hostname) ⇒ Object
15 16 17 |
# File 'lib/mofa/hostlist.rb', line 15 def self.get_shortname(hostname) hostname.gsub(/\..*$/, '') end |
Instance Method Details
#filter_by_runlist_map(runlist_map) ⇒ Object
32 33 34 |
# File 'lib/mofa/hostlist.rb', line 32 def filter_by_runlist_map(runlist_map) @list.select! { |hostname| runlist_map.mp.key?(hostname) } end |
#retrieve ⇒ Object
23 24 25 |
# File 'lib/mofa/hostlist.rb', line 23 def retrieve @list = [@concrete_target] end |
#up? ⇒ Boolean
27 28 29 30 |
# File 'lib/mofa/hostlist.rb', line 27 def up? p = Net::Ping::TCP.new(@service_host, 'http') p.ping? end |