diff options
author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
commit | 3180b9d9b2c844dade1d361326600f7001ec66dd (patch) | |
tree | 98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /lib/puppet/provider/service/gentoo.rb | |
parent | 543225970225de5697734bfaf0a6eee996802c04 (diff) | |
download | puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip |
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
Diffstat (limited to 'lib/puppet/provider/service/gentoo.rb')
-rw-r--r-- | lib/puppet/provider/service/gentoo.rb | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb index 109524bc0..08250a06a 100644 --- a/lib/puppet/provider/service/gentoo.rb +++ b/lib/puppet/provider/service/gentoo.rb @@ -1,52 +1,52 @@ # Manage gentoo services. Start/stop is the same as InitSvc, but enable/disable # is special. Puppet::Type.type(:service).provide :gentoo, :parent => :init do - desc "Gentoo's form of ``init``-style service management. + desc "Gentoo's form of ``init``-style service management. - Uses ``rc-update`` for service enabling and disabling. + Uses ``rc-update`` for service enabling and disabling. - " + " - commands :update => "/sbin/rc-update" + commands :update => "/sbin/rc-update" - confine :operatingsystem => :gentoo + confine :operatingsystem => :gentoo - defaultfor :operatingsystem => :gentoo + defaultfor :operatingsystem => :gentoo - def self.defpath - superclass.defpath - end + def self.defpath + superclass.defpath + end + + def disable + output = update :del, @resource[:name], :default + rescue Puppet::ExecutionFailure + raise Puppet::Error, "Could not disable #{self.name}: #{output}" + end - def disable - output = update :del, @resource[:name], :default + def enabled? + begin + output = update :show rescue Puppet::ExecutionFailure - raise Puppet::Error, "Could not disable #{self.name}: #{output}" + return :false end - def enabled? - begin - output = update :show - rescue Puppet::ExecutionFailure - return :false - end - - line = output.split(/\n/).find { |l| l.include?(@resource[:name]) } + line = output.split(/\n/).find { |l| l.include?(@resource[:name]) } - return :false unless line + return :false unless line - # If it's enabled then it will print output showing service | runlevel - if output =~ /^\s*#{@resource[:name]}\s*\|\s*(boot|default)/ - return :true - else - return :false - end + # If it's enabled then it will print output showing service | runlevel + if output =~ /^\s*#{@resource[:name]}\s*\|\s*(boot|default)/ + return :true + else + return :false end + end - def enable - output = update :add, @resource[:name], :default - rescue Puppet::ExecutionFailure - raise Puppet::Error, "Could not enable #{self.name}: #{output}" - end + def enable + output = update :add, @resource[:name], :default + rescue Puppet::ExecutionFailure + raise Puppet::Error, "Could not enable #{self.name}: #{output}" + end end # $Id $ |