web-puppet 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -2,15 +2,14 @@ A tiny ruby rack application which exposes the data from puppet as JSON over HTT
2
2
 
3
3
  gem install web-puppet
4
4
 
5
- Provides a simple command line tool which runs a built in web server. On accessing
6
- the specified port you should get a JSON response containing the current node information.
5
+ Provides a simple command line tool which runs a built in web server. On accessing the specified port you should get a JSON response containing the current node information.
7
6
 
8
7
  web-puppet --help
9
8
  Usage: web-puppet [options] ...
10
9
 
11
10
  Configuration options:
12
11
  --no-daemonize Don't daemonize the web server process
13
- -p, --port PORT The port to run web-facter on
12
+ -p, --port PORT The port to run web-puppet on
14
13
  -c, --config FILE The file to load with configuration options
15
14
  -h, --help Display this screenp
16
15
 
@@ -24,6 +23,13 @@ specifying the filename with the --config option above.
24
23
  password=george
25
24
  port=3009
26
25
  daemonize=true
26
+ filters="ec2_public_keys_0_openssh_key, ec2_userdata, sshdsakey, sshrsakey"
27
27
 
28
- Note that the port and daemonize options will override those on the command line.
29
- The username and password options enable HTTP basic authentication using those details.
28
+ Note that the port and daemonize options will override those on the command line. The username and password options enable HTTP basic authentication using details specified.
29
+
30
+ The filters option will remove sensitive items from the output, you can specify any keys you like and they'll be remove automatically.
31
+
32
+ If you're using puppet to manage your puppetmaster then the provided puppet module might be of use. Include in your puppet module diretory and modify as needed. You can use like so:
33
+
34
+ import "web-puppet"
35
+ class { "webpuppet": username => "username", password => "password" }
@@ -6,12 +6,16 @@ require 'parseconfig'
6
6
 
7
7
  module WebPuppet
8
8
  class App
9
- def call env
10
9
 
10
+ def initialize(filters=[])
11
+ @filters = filters
12
+ end
13
+
14
+ def call env
11
15
  Puppet[:config] = "/etc/puppet/puppet.conf"
12
16
  Puppet.parse_config
13
17
 
14
- Puppet[:clientyamldir] = "$yamldir"
18
+ Puppet[:clientyamldir] = Puppet[:yamldir]
15
19
  Puppet::Node.indirection.terminus_class = :yaml
16
20
 
17
21
  nodes = Puppet::Node.indirection.search("*")
@@ -20,6 +24,10 @@ module WebPuppet
20
24
  nodes.each do |n|
21
25
  facts = Puppet::Node::Facts.indirection.find(n.name)
22
26
  tags = Puppet::Resource::Catalog.indirection.find(n.name).tags
27
+ @filters.each do |filter|
28
+ facts.values.delete(filter.strip)
29
+ end
30
+
23
31
  data[n.name] = {
24
32
  :facts => facts.values,
25
33
  :tags => tags
@@ -44,13 +52,19 @@ module WebPuppet
44
52
  end
45
53
 
46
54
  def self.run!(options)
47
- application = self.new
55
+
56
+ conf = options[:config] ? ParseConfig.new(options[:config]) : false
57
+
58
+ if conf && conf.get_value('filters')
59
+ application = self.new(conf.get_value('filters').split(','))
60
+ else
61
+ application = self.new
62
+ end
48
63
 
49
64
  daemonize = options[:daemonize]
50
65
  port = options[:port]
51
66
 
52
- if options[:config]
53
- conf = ParseConfig.new(options[:config])
67
+ if conf
54
68
  application = application.add_auth(conf) if conf.get_value('password')
55
69
  daemonize = conf.get_value('daemonize') ? conf.get_value('daemonize') == "true" : daemonize
56
70
  port = conf.get_value('port') ? conf.get_value('port') : port
@@ -1,3 +1,3 @@
1
1
  module WebPuppet
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,8 @@
1
+ description "start and stop web-puppet"
2
+ author "Gareth Rushgrove"
3
+
4
+ expect daemon
5
+
6
+ env RUBY_BIN=/usr/bin
7
+
8
+ exec $RUBY_BIN/web-puppet --config /etc/web-puppet.conf
@@ -0,0 +1,32 @@
1
+ class webpuppet(
2
+ $port = '9295',
3
+ $username = false,
4
+ $password = false
5
+ ) {
6
+
7
+ package { "web-puppet":
8
+ ensure => installed,
9
+ provider => gem,
10
+ }
11
+
12
+ file { "/etc/web-puppet.conf":
13
+ ensure => present,
14
+ content => template('web-puppet/web-puppet.conf'),
15
+ notify => Service['web-puppet'],
16
+ }
17
+
18
+ file { "/etc/init/web-puppet.conf":
19
+ ensure => present,
20
+ source => "puppet:///modules/web-puppet/web-puppet",
21
+ }
22
+
23
+ service { "web-puppet":
24
+ ensure => running,
25
+ provider => upstart,
26
+ require => [
27
+ Package["web-puppet"],
28
+ File["/etc/init/web-puppet.conf"],
29
+ ]
30
+ }
31
+
32
+ }
@@ -0,0 +1,4 @@
1
+ port=<%= port %>
2
+ <% if username %>username=<%= username %><% end %>
3
+ <% if password %>password=<%= password %><% end %>
4
+ filters="ec2_public_keys_0_openssh_key, ec2_userdata, sshdsakey, sshrsakey"
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency "rack"
22
- s.add_runtime_dependency "puppet", ">= 2.7.0"
22
+ s.add_runtime_dependency "puppet", ">= 2.6.0"
23
23
  s.add_runtime_dependency "parseconfig"
24
24
 
25
25
  s.add_development_dependency "test-unit"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-06 00:00:00.000000000Z
12
+ date: 2011-11-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70117041200400 !ruby/object:Gem::Requirement
16
+ requirement: &70241318720520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70117041200400
24
+ version_requirements: *70241318720520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: puppet
27
- requirement: &70117041199780 !ruby/object:Gem::Requirement
27
+ requirement: &70241318720020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 2.7.0
32
+ version: 2.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70117041199780
35
+ version_requirements: *70241318720020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: parseconfig
38
- requirement: &70117041199260 !ruby/object:Gem::Requirement
38
+ requirement: &70241318719600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70117041199260
46
+ version_requirements: *70241318719600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: test-unit
49
- requirement: &70117041198680 !ruby/object:Gem::Requirement
49
+ requirement: &70241318719140 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70117041198680
57
+ version_requirements: *70241318719140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &70117041198200 !ruby/object:Gem::Requirement
60
+ requirement: &70241318718720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70117041198200
68
+ version_requirements: *70241318718720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
- requirement: &70117041197760 !ruby/object:Gem::Requirement
71
+ requirement: &70241318718300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70117041197760
79
+ version_requirements: *70241318718300
80
80
  description: Daemon which serves information from a local puppet master as JSON over
81
81
  HTTP
82
82
  email:
@@ -94,6 +94,9 @@ files:
94
94
  - bin/web-puppet
95
95
  - lib/web-puppet.rb
96
96
  - lib/web-puppet/version.rb
97
+ - puppet/modules/web-puppet/files/web-puppet
98
+ - puppet/modules/web-puppet/manifests/init.pp
99
+ - puppet/modules/web-puppet/templates/web-puppet.conf
97
100
  - test/integration_test.rb
98
101
  - test/test_helper.rb
99
102
  - web-puppet.gemspec