Class: CapistranoPuppet::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-puppet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_webObject (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_listObject (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