[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Matt Robinson
matt at puppetlabs.com
Tue May 10 08:01:29 UTC 2011
The following commit has been merged in the experimental branch:
commit c643e98c57e781353bfac55e7edb6690450076e3
Author: Matt Robinson <matt at puppetlabs.com>
Date: Tue Nov 16 11:21:35 2010 -0800
(#5079) Move methods around to make it clearer whether they're public or private
One method was showing up as a private class method, which turns out
isn't possible, so it got moved into the public section.
This is a rework for diff clarity of a patch submitted by
Sandor Szuecs <sandor.szuecs at fu-berlin.de>
Reviewed-by: Paul Berry <paul at puppetlabs.com>
diff --git a/lib/puppet/provider/mcx/mcxcontent.rb b/lib/puppet/provider/mcx/mcxcontent.rb
index cb5adc6..b7cc40b 100644
--- a/lib/puppet/provider/mcx/mcxcontent.rb
+++ b/lib/puppet/provider/mcx/mcxcontent.rb
@@ -82,10 +82,6 @@ Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
mcx_list
end
- private
-
- # mcxexport is used by instances, and therefore
- # a class method.
def self.mcxexport(ds_type, ds_name)
ds_t = TypeMap[ds_type]
ds_n = ds_name.to_s
@@ -93,6 +89,54 @@ Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
dscl 'localhost', '-mcxexport', ds_path
end
+
+ def create
+ self.content=(resource[:content])
+ end
+
+ def destroy
+ ds_parms = get_dsparams
+ ds_t = TypeMap[ds_parms[:ds_type]]
+ ds_n = ds_parms[:ds_name].to_s
+ ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
+
+ dscl 'localhost', '-mcxdelete', ds_path
+ end
+
+ def exists?
+ # JJM Just re-use the content method and see if it's empty.
+ begin
+ mcx = content
+ rescue Puppet::ExecutionFailure => e
+ return false
+ end
+ has_mcx = ! mcx.empty?
+ end
+
+ def content
+ ds_parms = get_dsparams
+
+ mcx = self.class.mcxexport(
+ ds_parms[:ds_type],
+
+ ds_parms[:ds_name])
+ mcx
+ end
+
+ def content=(value)
+ # dscl localhost -mcximport
+ ds_parms = get_dsparams
+
+ mcx = mcximport(
+ ds_parms[:ds_type],
+ ds_parms[:ds_name],
+
+ resource[:content])
+ mcx
+ end
+
+ private
+
def mcximport(ds_type, ds_name, val)
ds_t = TypeMap[ds_type]
ds_n = ds_name.to_s
@@ -155,51 +199,4 @@ Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
end
- public
-
- def create
- self.content=(resource[:content])
- end
-
- def destroy
- ds_parms = get_dsparams
- ds_t = TypeMap[ds_parms[:ds_type]]
- ds_n = ds_parms[:ds_name].to_s
- ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
-
- dscl 'localhost', '-mcxdelete', ds_path
- end
-
- def exists?
- # JJM Just re-use the content method and see if it's empty.
- begin
- mcx = content
- rescue Puppet::ExecutionFailure => e
- return false
- end
- has_mcx = ! mcx.empty?
- end
-
- def content
- ds_parms = get_dsparams
-
- mcx = self.class.mcxexport(
- ds_parms[:ds_type],
-
- ds_parms[:ds_name])
- mcx
- end
-
- def content=(value)
- # dscl localhost -mcximport
- ds_parms = get_dsparams
-
- mcx = mcximport(
- ds_parms[:ds_type],
- ds_parms[:ds_name],
-
- resource[:content])
- mcx
- end
-
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list