puppet-rundeck 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,6 +54,11 @@ To use with RunDeck specify the target URL as the value of the `project.resource
54
54
 
55
55
  project.resources.url = http://localhost:8144
56
56
 
57
+ Yo can also specify a required tag to filter the node list, to provide different project URLs based
58
+ on the same puppet server and puppet-rundeck instance:
59
+
60
+ project.resources.url = http://localhost:8144/tag/production
61
+
57
62
  You can specify some configuration options:
58
63
 
59
64
  * -c or --config to override the default Puppet configuration file (defaults to `/etc/puppet/puppet.conf`)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Copyright 2010, James Turnbull
4
- #
4
+ #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
7
7
  # You may obtain a copy of the License at
8
- #
8
+ #
9
9
  # http://www.apache.org/licenses/LICENSE-2.0
10
- #
10
+ #
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,11 +30,11 @@ optparse = OptionParser.new do |opts|
30
30
 
31
31
  opts.separator ''
32
32
  opts.separator 'Configuration options:'
33
-
34
- options[:config_file] = "/etc/puppet/puppet.conf"
33
+
34
+ options[:config_file] = "/etc/puppet/puppet.conf"
35
35
  opts.on( '-c', '--config FILE', 'Specify the location of your Puppet configuration file') do |config_file|
36
36
  options[:config_file] = config_file
37
- end
37
+ end
38
38
 
39
39
  options[:username] = ENV['USER']
40
40
  opts.on( '-u', '--username USERNAME', 'The Username for Rundeck to SSH as') do |username|
@@ -46,9 +46,19 @@ optparse = OptionParser.new do |opts|
46
46
  options[:port] = port
47
47
  end
48
48
 
49
+ options[:bind] = "localhost"
50
+ opts.on( '-b', '--bind HOSTNAME', 'The hostname or IP address of the interface to run puppet-rundeck on') do |bind|
51
+ options[:bind] = bind
52
+ end
53
+
54
+ options[:ssh_port] = 22
55
+ opts.on( '-P', '--ssh-port PORT', 'The default port used by sshd on your puppet nodes') do |ssh_port|
56
+ options[:ssh_port] = ssh_port
57
+ end
58
+
49
59
  opts.separator ""
50
60
  opts.separator "Common options:"
51
-
61
+
52
62
  opts.on_tail('-h', '--help', 'Display this screen' ) do
53
63
  puts opts
54
64
  exit
@@ -59,8 +69,9 @@ begin
59
69
  optparse.parse!
60
70
  PuppetRundeck.config_file = options[:config_file]
61
71
  PuppetRundeck.username = options[:username]
72
+ PuppetRundeck.ssh_port = options[:ssh_port]
62
73
  PuppetRundeck.configure
63
- PuppetRundeck.run! :host => "localhost", :port => options[:port]
74
+ PuppetRundeck.run! :bind => options[:bind], :port => options[:port]
64
75
  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption, OptionParser::MissingArgument
65
76
  puts $!.to_s
66
77
  puts optparse
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2011, James Turnbull
2
+ # Copyright 2012, 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.
@@ -19,6 +19,7 @@ require 'builder/xchar'
19
19
 
20
20
  begin
21
21
  require 'puppet'
22
+ require 'puppet/face'
22
23
  rescue LoadError
23
24
  puts "You need to have Puppet 0.25.5 or later installed"
24
25
  end
@@ -29,6 +30,7 @@ class PuppetRundeck < Sinatra::Base
29
30
  attr_accessor :config_file
30
31
  attr_accessor :username
31
32
  attr_accessor :source
33
+ attr_accessor :ssh_port
32
34
 
33
35
  def configure
34
36
  Puppet[:config] = PuppetRundeck.config_file
@@ -46,7 +48,7 @@ class PuppetRundeck < Sinatra::Base
46
48
  response['Content-Type'] = 'text/xml'
47
49
  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)
48
50
  # Fix for 2.6 to 2.7 indirection difference
49
- Puppet[:clientyamldir] = "$yamldir"
51
+ Puppet[:clientyamldir] = "$yamldir"
50
52
  if Puppet::Node.respond_to? :terminus_class
51
53
  Puppet::Node.terminus_class = :yaml
52
54
  nodes = Puppet::Node.search("*")
@@ -54,13 +56,14 @@ class PuppetRundeck < Sinatra::Base
54
56
  Puppet::Node.indirection.terminus_class = :yaml
55
57
  nodes = Puppet::Node.indirection.search("*")
56
58
  end
59
+ Puppet::Node.indirection.terminus_class = :plain
57
60
  nodes.each do |n|
58
61
  if Puppet::Node::Facts.respond_to? :find
59
62
  tags = Puppet::Resource::Catalog.find(n.name).tags
60
63
  else
61
- tags = Puppet::Resource::Catalog.indirection.find(n.name).tags
64
+ tags = Puppet::Face[:catalog, :current].find(n.name).tags
62
65
  end
63
- facts = n.parameters
66
+ facts = n.values #n.parameters
64
67
  os_family = facts["kernel"] =~ /windows/i ? 'windows' : 'unix'
65
68
  response_xml << <<-EOH
66
69
  <node name="#{xml_escape(n.name)}"
@@ -70,7 +73,7 @@ class PuppetRundeck < Sinatra::Base
70
73
  osFamily="#{xml_escape(os_family)}"
71
74
  osName="#{xml_escape(facts["operatingsystem"])}"
72
75
  osVersion="#{xml_escape(facts["operatingsystemrelease"])}"
73
- tags="#{xml_escape([n.environment, tags.join(',')].join(','))}"
76
+ tags="#{xml_escape(tags.join(','))}"
74
77
  username="#{xml_escape(PuppetRundeck.username)}"
75
78
  hostname="#{xml_escape(facts["fqdn"])}"/>
76
79
  EOH
metadata CHANGED
@@ -1,92 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: puppet-rundeck
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 7
10
- version: 0.0.7
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - James Turnbull
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-22 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: sinatra
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: builder
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: builder
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 15
43
- segments:
44
- - 2
45
- - 0
46
- - 0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
47
37
  version: 2.0.0
48
38
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rspec
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
54
49
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 13
59
- segments:
60
- - 1
61
- - 2
62
- - 9
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
63
53
  version: 1.2.9
64
54
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: yard
68
55
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
70
57
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.9
62
+ - !ruby/object:Gem::Dependency
63
+ name: yard
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
78
70
  type: :development
79
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
80
78
  description: Provides a resource endpoint for RunDeck from a Puppet Server
81
79
  email: james@puppetlabs.com
82
- executables:
80
+ executables:
83
81
  - puppet-rundeck
84
82
  extensions: []
85
-
86
- extra_rdoc_files:
83
+ extra_rdoc_files:
87
84
  - LICENSE
88
85
  - README.rdoc
89
- files:
86
+ files:
90
87
  - LICENSE
91
88
  - README.rdoc
92
89
  - Rakefile
@@ -96,39 +93,31 @@ files:
96
93
  - spec/spec_helper.rb
97
94
  - bin/puppet-rundeck
98
95
  homepage: http://github.com/jamtur01/puppet-rundeck
99
- licenses: []
100
-
96
+ licenses:
97
+ - Apache-2.0
101
98
  post_install_message:
102
- rdoc_options:
99
+ rdoc_options:
103
100
  - --charset=UTF-8
104
- require_paths:
101
+ require_paths:
105
102
  - lib
106
- required_ruby_version: !ruby/object:Gem::Requirement
103
+ required_ruby_version: !ruby/object:Gem::Requirement
107
104
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
113
- - 0
114
- version: "0"
115
- required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
110
  none: false
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
- version: "0"
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
124
115
  requirements: []
125
-
126
116
  rubyforge_project:
127
- rubygems_version: 1.8.11
117
+ rubygems_version: 1.8.28
128
118
  signing_key:
129
119
  specification_version: 3
130
120
  summary: Integrates Puppet with RunDeck
131
- test_files:
121
+ test_files:
132
122
  - spec/puppet-rundesk_spec.rb
133
123
  - spec/spec_helper.rb
134
- has_rdoc: