puppet-rundeck 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/puppet-rundeck.rb +25 -7
- metadata +10 -26
data/Rakefile
CHANGED
@@ -13,7 +13,6 @@ begin
|
|
13
13
|
gem.homepage = "http://github.com/jamtur01/puppet-rundeck"
|
14
14
|
gem.authors = ["James Turnbull"]
|
15
15
|
gem.add_dependency "sinatra"
|
16
|
-
gem.add_dependency "puppet", ">= 0.24.8"
|
17
16
|
gem.add_dependency "builder", ">= 2.0.0"
|
18
17
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
19
18
|
gem.add_development_dependency "yard", ">= 0"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/puppet-rundeck.rb
CHANGED
@@ -15,9 +15,14 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require 'sinatra/base'
|
18
|
-
require 'puppet'
|
19
18
|
require 'builder/xchar'
|
20
19
|
|
20
|
+
begin
|
21
|
+
require 'puppet'
|
22
|
+
rescue LoadError
|
23
|
+
puts "You need to have Puppet 0.24.8 or later installed"
|
24
|
+
end
|
25
|
+
|
21
26
|
class PuppetRundeck < Sinatra::Base
|
22
27
|
|
23
28
|
class << self
|
@@ -36,23 +41,36 @@ class PuppetRundeck < Sinatra::Base
|
|
36
41
|
return input.to_s.to_xs
|
37
42
|
end
|
38
43
|
|
44
|
+
require 'pp'
|
39
45
|
get '/' do
|
40
46
|
response = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project PUBLIC "-//DTO Labs Inc.//DTD Resources Document 1.0//EN" "project.dtd"><project>'
|
41
|
-
|
47
|
+
# Fix for 2.6 to 2.7 indirection difference
|
42
48
|
Puppet[:clientyamldir] = "$yamldir"
|
43
|
-
|
49
|
+
if Puppet::Node.respond_to? :terminus_class
|
50
|
+
Puppet::Node.terminus_class = :yaml
|
51
|
+
nodes = Puppet::Node.search("*")
|
52
|
+
else
|
53
|
+
Puppet::Node.indirection.terminus_class = :yaml
|
54
|
+
nodes = Puppet::Node.indirection.search("*")
|
55
|
+
end
|
44
56
|
nodes.each do |n|
|
45
|
-
|
46
|
-
|
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'
|
47
65
|
response << <<-EOH
|
48
66
|
<node name="#{xml_escape(n.name)}"
|
49
67
|
type="Node"
|
50
68
|
description="#{xml_escape(n.name)}"
|
51
69
|
osArch="#{xml_escape(facts.values["kernel"])}"
|
52
|
-
osFamily="#{xml_escape(
|
70
|
+
osFamily="#{xml_escape(os_family)}"
|
53
71
|
osName="#{xml_escape(facts.values["operatingsystem"])}"
|
54
72
|
osVersion="#{xml_escape(facts.values["operatingsystemrelease"])}"
|
55
|
-
tags="#{xml_escape(tags.join(','))}"
|
73
|
+
tags="#{xml_escape([n.environment, tags.join(',')].join(','))}"
|
56
74
|
username="#{xml_escape(PuppetRundeck.username)}"
|
57
75
|
hostname="#{xml_escape(facts.values["fqdn"])}"/>
|
58
76
|
EOH
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
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-
|
18
|
+
date: 2011-07-27 00:00:00 +10:00
|
19
19
|
default_executable: puppet-rundeck
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,26 +32,10 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: puppet
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 111
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 24
|
47
|
-
- 8
|
48
|
-
version: 0.24.8
|
49
|
-
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
35
|
- !ruby/object:Gem::Dependency
|
52
36
|
name: builder
|
53
37
|
prerelease: false
|
54
|
-
requirement: &
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
39
|
none: false
|
56
40
|
requirements:
|
57
41
|
- - ">="
|
@@ -63,11 +47,11 @@ dependencies:
|
|
63
47
|
- 0
|
64
48
|
version: 2.0.0
|
65
49
|
type: :runtime
|
66
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
67
51
|
- !ruby/object:Gem::Dependency
|
68
52
|
name: rspec
|
69
53
|
prerelease: false
|
70
|
-
requirement: &
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
71
55
|
none: false
|
72
56
|
requirements:
|
73
57
|
- - ">="
|
@@ -79,11 +63,11 @@ dependencies:
|
|
79
63
|
- 9
|
80
64
|
version: 1.2.9
|
81
65
|
type: :development
|
82
|
-
version_requirements: *
|
66
|
+
version_requirements: *id003
|
83
67
|
- !ruby/object:Gem::Dependency
|
84
68
|
name: yard
|
85
69
|
prerelease: false
|
86
|
-
requirement: &
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
87
71
|
none: false
|
88
72
|
requirements:
|
89
73
|
- - ">="
|
@@ -93,7 +77,7 @@ dependencies:
|
|
93
77
|
- 0
|
94
78
|
version: "0"
|
95
79
|
type: :development
|
96
|
-
version_requirements: *
|
80
|
+
version_requirements: *id004
|
97
81
|
description: Provides a resource endpoint for RunDeck from a Puppet Server
|
98
82
|
email: james@puppetlabs.com
|
99
83
|
executables:
|