Class: CapistranoPuppet::Server
- Inherits:
-
Object
- Object
- CapistranoPuppet::Server
- Defined in:
- lib/capistrano-puppet.rb
Instance Attribute Summary collapse
-
#puppet_web ⇒ Object
readonly
Returns the value of attribute puppet_web.
-
#server_list ⇒ Object
readonly
Returns the value of attribute server_list.
Instance Method Summary collapse
- #get_servers(tag) ⇒ Object
-
#initialize(puppet_web) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(puppet_web) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 |
# File 'lib/capistrano-puppet.rb', line 11 def initialize(puppet_web) @puppet_web = puppet_web contents = RestClient.get(@puppet_web).to_s @json = JSON.parse(contents) end |
Instance Attribute Details
#puppet_web ⇒ Object (readonly)
Returns the value of attribute puppet_web.
9 10 11 |
# File 'lib/capistrano-puppet.rb', line 9 def puppet_web @puppet_web end |
#server_list ⇒ Object (readonly)
Returns the value of attribute server_list.
8 9 10 |
# File 'lib/capistrano-puppet.rb', line 8 def server_list @server_list end |
Instance Method Details
#get_servers(tag) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/capistrano-puppet.rb', line 17 def get_servers(tag) server_list = [] @json.each do |host, details| server_list << host if details['tags'].include? tag end server_list end |