diff options
| author | James Turnbull <james@lovedthanlost.net> | 2010-01-13 08:07:30 +1100 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2010-01-13 08:07:30 +1100 |
| commit | b6f90dfcd96123c245b6f5fd93753790006387c0 (patch) | |
| tree | 1668fd8ed480dc0d0cb49c4a3d7f8a13c77dbeb9 /lib/puppet/application | |
| parent | e26e8319186c57a41ea7ca58b0e8e853e9b452e3 (diff) | |
| parent | f7e14356ad7781fafa52a459d3c24372fa6c0900 (diff) | |
Merge branch '0.25.x'
Conflicts:
lib/puppet/ssl/host.rb
spec/spec_helper.rb
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/puppet.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/application/puppetdoc.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/application/puppetrun.rb | 19 | ||||
| -rw-r--r-- | lib/puppet/application/ralsh.rb | 34 |
4 files changed, 16 insertions, 41 deletions
diff --git a/lib/puppet/application/puppet.rb b/lib/puppet/application/puppet.rb index b4c06d279..e4baf5d05 100644 --- a/lib/puppet/application/puppet.rb +++ b/lib/puppet/application/puppet.rb @@ -49,7 +49,7 @@ Puppet::Application.new(:puppet) do end begin - catalog = PSON.parse(text) + catalog = Puppet::Resource::Catalog.convert_from(Puppet::Resource::Catalog.default_format,text) unless catalog.is_a?(Puppet::Resource::Catalog) catalog = Puppet::Resource::Catalog.pson_create(catalog) end diff --git a/lib/puppet/application/puppetdoc.rb b/lib/puppet/application/puppetdoc.rb index 0a4e0c3c3..e0033277f 100644 --- a/lib/puppet/application/puppetdoc.rb +++ b/lib/puppet/application/puppetdoc.rb @@ -68,7 +68,7 @@ Puppet::Application.new(:puppetdoc) do unless @manifest env = Puppet::Node::Environment.new files += env.modulepath - files += env.manifestdir + files << File.dirname(env[:manifest]) end files += ARGV Puppet.info "scanning: %s" % files.inspect diff --git a/lib/puppet/application/puppetrun.rb b/lib/puppet/application/puppetrun.rb index 2dbd803fa..4febcf524 100644 --- a/lib/puppet/application/puppetrun.rb +++ b/lib/puppet/application/puppetrun.rb @@ -1,18 +1,9 @@ -begin - require 'rubygems' -rescue LoadError - # Nothing; we were just doing this just in case -end - -begin - require 'ldap' -rescue LoadError - $stderr.puts "Failed to load ruby LDAP library. LDAP functionality will not be available" -end - require 'puppet' require 'puppet/application' +Puppet.warning "RubyGems not installed" unless Puppet.features.rubygems? +Puppet.warning "Failed to load ruby LDAP library. LDAP functionality will not be available" unless Puppet.features.ldap? + Puppet::Application.new(:puppetrun) do should_not_parse_config @@ -176,12 +167,12 @@ Puppet::Application.new(:puppetrun) do if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes) if options[:all] - @hosts = Puppet::Node.search("whatever").collect { |node| node.name } + @hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name } puts "all: %s" % @hosts.join(", ") else @hosts = [] @classes.each do |klass| - list = Puppet::Node.search("whatever", :class => klass).collect { |node| node.name } + list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name } puts "%s: %s" % [klass, list.join(", ")] @hosts += list diff --git a/lib/puppet/application/ralsh.rb b/lib/puppet/application/ralsh.rb index 6ad520dca..b9f7a587c 100644 --- a/lib/puppet/application/ralsh.rb +++ b/lib/puppet/application/ralsh.rb @@ -38,25 +38,15 @@ Puppet::Application.new(:ralsh) do end command(:main) do - if ARGV.length > 0 - type = ARGV.shift - else - raise "You must specify the type to display" - end - - name = nil + type = ARGV.shift or raise "You must specify the type to display" + typeobj = Puppet::Type.type(type) or raise "Could not find type #{type}" + name = ARGV.shift params = {} - if ARGV.length > 0 - name = ARGV.shift - end - - if ARGV.length > 0 - ARGV.each do |setting| - if setting =~ /^(\w+)=(.+)$/ - params[$1] = $2 - else - raise "Invalid parameter setting %s" % setting - end + ARGV.each do |setting| + if setting =~ /^(\w+)=(.+)$/ + params[$1] = $2 + else + raise "Invalid parameter setting %s" % setting end end @@ -64,12 +54,6 @@ Puppet::Application.new(:ralsh) do raise "You cannot edit a remote host" end - typeobj = nil - - unless typeobj = Puppet::Type.type(type) - raise "Could not find type %s" % type - end - properties = typeobj.properties.collect { |s| s.name } format = proc {|trans| @@ -106,7 +90,7 @@ Puppet::Application.new(:ralsh) do transbucket.sort { |a,b| a.name <=> b.name }.collect(&format) else if name - obj = typeobj.new(:name => name, :check => properties) + obj = typeobj.instances.find { |o| o.name == name } || typeobj.new(:name => name, :check => properties) vals = obj.retrieve unless params.empty? |
