puppet-rundeck 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -51,11 +51,6 @@ optparse = OptionParser.new do |opts|
51
51
  options[:bind] = bind
52
52
  end
53
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
-
59
54
  opts.separator ""
60
55
  opts.separator "Common options:"
61
56
 
@@ -69,7 +64,6 @@ begin
69
64
  optparse.parse!
70
65
  PuppetRundeck.config_file = options[:config_file]
71
66
  PuppetRundeck.username = options[:username]
72
- PuppetRundeck.ssh_port = options[:ssh_port]
73
67
  PuppetRundeck.configure
74
68
  PuppetRundeck.run! :bind => options[:bind], :port => options[:port]
75
69
  rescue OptionParser::InvalidArgument, OptionParser::InvalidOption, OptionParser::MissingArgument
@@ -15,7 +15,7 @@
15
15
  #
16
16
 
17
17
  require 'sinatra/base'
18
- require 'builder/xchar'
18
+ require 'fast_xs'
19
19
 
20
20
  begin
21
21
  require 'puppet'
@@ -30,7 +30,6 @@ class PuppetRundeck < Sinatra::Base
30
30
  attr_accessor :config_file
31
31
  attr_accessor :username
32
32
  attr_accessor :source
33
- attr_accessor :ssh_port
34
33
 
35
34
  def configure
36
35
  Puppet[:config] = PuppetRundeck.config_file
@@ -40,15 +39,14 @@ class PuppetRundeck < Sinatra::Base
40
39
 
41
40
  def xml_escape(input)
42
41
  # don't know if is string, so convert to string first, then to XML escaped text.
43
- return input.to_s.to_xs
42
+ return input.to_s.fast_xs
44
43
  end
45
44
 
46
- require 'pp'
47
- get '/' do
45
+ def respond(required_tag=nil)
48
46
  response['Content-Type'] = 'text/xml'
49
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)
50
48
  # Fix for 2.6 to 2.7 indirection difference
51
- Puppet[:clientyamldir] = "$yamldir"
49
+ Puppet[:clientyamldir] = "$yamldir"
52
50
  if Puppet::Node.respond_to? :terminus_class
53
51
  Puppet::Node.terminus_class = :yaml
54
52
  nodes = Puppet::Node.search("*")
@@ -63,7 +61,10 @@ class PuppetRundeck < Sinatra::Base
63
61
  else
64
62
  tags = Puppet::Face[:catalog, :current].find(n.name).tags
65
63
  end
66
- facts = n.values #n.parameters
64
+ if ! required_tag.nil?
65
+ next if ! tags.include? required_tag
66
+ end
67
+ facts = n.parameters
67
68
  os_family = facts["kernel"] =~ /windows/i ? 'windows' : 'unix'
68
69
  response_xml << <<-EOH
69
70
  <node name="#{xml_escape(n.name)}"
@@ -73,7 +74,7 @@ class PuppetRundeck < Sinatra::Base
73
74
  osFamily="#{xml_escape(os_family)}"
74
75
  osName="#{xml_escape(facts["operatingsystem"])}"
75
76
  osVersion="#{xml_escape(facts["operatingsystemrelease"])}"
76
- tags="#{xml_escape(tags.join(','))}"
77
+ tags="#{xml_escape([n.environment, tags.join(',')].join(','))}"
77
78
  username="#{xml_escape(PuppetRundeck.username)}"
78
79
  hostname="#{xml_escape(facts["fqdn"])}"/>
79
80
  EOH
@@ -81,4 +82,12 @@ EOH
81
82
  response_xml << "</project>"
82
83
  response_xml
83
84
  end
85
+
86
+ get '/' do
87
+ respond
88
+ end
89
+
90
+ get '/tag/:tag' do
91
+ respond(params[:tag])
92
+ end
84
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-rundeck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -28,13 +28,13 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: builder
31
+ name: fast_xs
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.0.0
37
+ version: '0'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.0
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rspec
48
48
  requirement: !ruby/object:Gem::Requirement