puppet-rundeck 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +5 -5
  2. data/VERSION +1 -1
  3. data/lib/puppet-rundeck.rb +14 -19
  4. metadata +4 -4
data/README.rdoc CHANGED
@@ -12,7 +12,7 @@ Note: Version 0.0.2 required stored configuration to be enabled. Later versions
12
12
 
13
13
  Requires:
14
14
 
15
- - Puppet
15
+ - Puppet (0.25.5 and later)
16
16
  - Builder (2.0.0 and later)
17
17
 
18
18
  == Installation
@@ -34,7 +34,7 @@ Then browse to appropriate URL, by default `localhost:8144`
34
34
  A list of the current hosts and appropriate facts to configure them on RunDeck will be returned in XML.
35
35
 
36
36
  For example:
37
-
37
+
38
38
  <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd">
39
39
  <project>
40
40
  <node name="pelin.lovedthanlost.net"
@@ -44,7 +44,7 @@ For example:
44
44
  osFamily="Linux"
45
45
  osName="Fedora"
46
46
  osVersion="14"
47
- tags="nil"
47
+ tags="production"
48
48
  username="root"
49
49
  hostname="pelin.lovedthanlost.net"/>
50
50
  </project>
@@ -63,7 +63,7 @@ You can specify some configuration options:
63
63
  == Credits
64
64
 
65
65
  Original concept heavily stolen from Adam Jacob's chef-rundeck gem
66
-
66
+
67
67
  == Copyright
68
68
 
69
- Copyright (c) 2010 James Turnbull. See LICENSE for details.
69
+ Copyright (c) 2011 James Turnbull. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2010, James Turnbull
2
+ # Copyright 2011, James Turnbull
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ require 'builder/xchar'
20
20
  begin
21
21
  require 'puppet'
22
22
  rescue LoadError
23
- puts "You need to have Puppet 0.24.8 or later installed"
23
+ puts "You need to have Puppet 0.25.5 or later installed"
24
24
  end
25
25
 
26
26
  class PuppetRundeck < Sinatra::Base
@@ -43,7 +43,8 @@ class PuppetRundeck < Sinatra::Base
43
43
 
44
44
  require 'pp'
45
45
  get '/' do
46
- response = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd"><project>'
46
+ response['Content-Type'] = 'text/xml'
47
+ response_xml = %Q(<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd">\n<project>\n)
47
48
  # Fix for 2.6 to 2.7 indirection difference
48
49
  Puppet[:clientyamldir] = "$yamldir"
49
50
  if Puppet::Node.respond_to? :terminus_class
@@ -54,28 +55,22 @@ class PuppetRundeck < Sinatra::Base
54
55
  nodes = Puppet::Node.indirection.search("*")
55
56
  end
56
57
  nodes.each do |n|
57
- if Puppet::Node::Facts.respond_to? :find
58
- facts = Puppet::Node::Facts.find(n.name)
59
- tags = Puppet::Resource::Catalog.find(n.name).tags
60
- else
61
- facts = Puppet::Node::Facts.indirection.find(n.name)
62
- tags = Puppet::Resource::Catalog.indirection.find(n.name).tags
63
- end
64
- os_family = facts.values["kernel"] =~ /windows/i ? 'windows' : 'unix'
65
- response << <<-EOH
58
+ facts = n.parameters
59
+ os_family = facts["kernel"] =~ /windows/i ? 'windows' : 'unix'
60
+ response_xml << <<-EOH
66
61
  <node name="#{xml_escape(n.name)}"
67
62
  type="Node"
68
63
  description="#{xml_escape(n.name)}"
69
- osArch="#{xml_escape(facts.values["kernel"])}"
64
+ osArch="#{xml_escape(facts["kernel"])}"
70
65
  osFamily="#{xml_escape(os_family)}"
71
- osName="#{xml_escape(facts.values["operatingsystem"])}"
72
- osVersion="#{xml_escape(facts.values["operatingsystemrelease"])}"
73
- tags="#{xml_escape([n.environment, tags.join(',')].join(','))}"
66
+ osName="#{xml_escape(facts["operatingsystem"])}"
67
+ osVersion="#{xml_escape(facts["operatingsystemrelease"])}"
68
+ tags="#{xml_escape([n.environment])}"
74
69
  username="#{xml_escape(PuppetRundeck.username)}"
75
- hostname="#{xml_escape(facts.values["fqdn"])}"/>
70
+ hostname="#{xml_escape(facts["fqdn"])}"/>
76
71
  EOH
77
72
  end
78
- response << "</project>"
79
- response
73
+ response_xml << "</project>"
74
+ response_xml
80
75
  end
81
76
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-rundeck
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Turnbull
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-27 00:00:00 +10:00
18
+ date: 2011-11-22 00:00:00 +11:00
19
19
  default_executable: puppet-rundeck
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency