diff options
| author | Markus Roberts <Markus@reality.com> | 2009-12-21 15:10:40 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-12-23 19:22:56 +1100 |
| commit | e04f9e4823208e2d8a48ecc25fdf5152ed09ae77 (patch) | |
| tree | ec9a8516144835fc98c834c61478476f40efd5a0 /lib/puppet/application | |
| parent | 24654a22c2d172b23cb1133f65da4e5a2801de0a (diff) | |
| download | puppet-e04f9e4823208e2d8a48ecc25fdf5152ed09ae77.tar.gz puppet-e04f9e4823208e2d8a48ecc25fdf5152ed09ae77.tar.xz puppet-e04f9e4823208e2d8a48ecc25fdf5152ed09ae77.zip | |
Code smell reductions
These are a grab-bag of code simplification changes I made in
the process of figuring out what was going on with #2881; they
should all be absolutely behavior neutral.
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/ralsh.rb | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/lib/puppet/application/ralsh.rb b/lib/puppet/application/ralsh.rb index 6ad520dca..a9921d7a7 100644 --- a/lib/puppet/application/ralsh.rb +++ b/lib/puppet/application/ralsh.rb @@ -38,25 +38,16 @@ 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 +55,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| |
