summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/mount.rb
Commit message (Collapse)AuthorAgeFilesLines
* maint: remove inaccurate copyright and license statements.Daniel Pittman2011-08-181-3/+0
| | | | | | | | | | | For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* (#4914) Query property_hash for mountstateStefan Schulte2011-01-251-14/+12
| | | | | | | | | Change mounted? to query the property_hash so we don't have to run the mountcommand for every specified mount but rely on the prefetched state Also update the prefetched property_hash[:ensure] after mount or umount. This is important if we query mounted? later (most obvious when refresh is called. We dont want to remount a resource that was umounted before)
* Fix for #4279 -- mount detection on HP-UXMarkus Roberts2010-11-161-1/+1
| | | | | This is based on the discussion on ticket, simplified slightly and with test adjustment.
* Code smell: Two space indentationMarkus Roberts2010-07-091-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Code smell: Avoid needless decorationsMarkus Roberts2010-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2 3 Examples: The code: ctx = OpenSSL::SSL::SSLContext.new() becomes: ctx = OpenSSL::SSL::SSLContext.new The code: skip() becomes: skip The code: path = tempfile() becomes: path = tempfile * Replaced 31 occurances of ^( *)end *#.* with \1end 3 Examples: The code: becomes: The code: end # Dir.foreach becomes: end The code: end # def becomes: end
* Code smell: Line modifiers are preferred to one-line blocks.Markus Roberts2010-07-091-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 6 occurances of (while .*?) *do$ with The do is unneeded in the block header form and causes problems with the block-to-one-line transformation. 3 Examples: The code: while line = f.gets do becomes: while line = f.gets The code: while line = shadow.gets do becomes: while line = shadow.gets The code: while wrapper = zeros.pop do becomes: while wrapper = zeros.pop * Replaced 19 occurances of ((if|unless) .*?) *then$ with The then is unneeded in the block header form and causes problems with the block-to-one-line transformation. 3 Examples: The code: if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then becomes: if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } The code: unless defined?(@spec_command) then becomes: unless defined?(@spec_command) The code: if c == ?\n then becomes: if c == ?\n * Replaced 758 occurances of ((?:if|unless|while|until) .*) (.*) end with The one-line form is preferable provided: * The condition is not used to assign a variable * The body line is not already modified * The resulting line is not too long 3 Examples: The code: if Puppet.features.libshadow? has_feature :manages_passwords end becomes: has_feature :manages_passwords if Puppet.features.libshadow? The code: unless (defined?(@current_pool) and @current_pool) @current_pool = process_zpool_data(get_pool_data) end becomes: @current_pool = process_zpool_data(get_pool_data) unless (defined?(@current_pool) and @current_pool) The code: if Puppet[:trace] puts detail.backtrace end becomes: puts detail.backtrace if Puppet[:trace]
* Adding unit tests for the module that handles theLuke Kanies2007-11-081-7/+10
| | | | | logic around mounting and unmounting. This includes a fix for bug #761, which required a different regex for Solaris.
* The whole system now uses Configuration objects instead ofLuke Kanies2007-09-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ever converting the Transportable objects into a tree of components and then converting that into a graph. This is a significant step, and drastically simplifies the model of how to use a configuration. The old code might have looked something like this: file = Puppet::Type.create :path => "/whatever", ... comp = Puppet::Type.create :name => :whatever comp.push file transaction = comp.evaluate transaction.evaluate The new code looks like this: file = Puppet::Type.create :path => "/whatever", ... config = Puppet::Node::Configuration.new config.add_resource file config.apply I did not really intend to do this much refactoring, but I found I could not use a Configuration object to do work without refactoring a lot of the system. The primary problem was that the Client::Master and the Config classes determined how the transactions behaved; when I moved to using a Configuration, this distinction was lost, which meant that configurations were often needing to create other configurations, which resulted in a whole lot of infinite recursion (e.g., Config objects that create directories for Puppet use Configuration objects -- yes, I'm s/Config/Settings/g soon -- and these Configuration objects would need to create directories). Not everything is fixed, but it's very close. I am clearly over the hump, though, so I wanted to get a commit in.
* Fixing #730 -- mounts now call flush() before trying to mountluke2007-08-051-0/+3
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2745 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #702, hopefully. As suggested, I switched to "mount" instead of "df" ↵luke2007-07-181-10/+4
| | | | | | to determine whether an fs is mounted. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2707 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #605 -- providers now refer to @resource or @resource_type.luke2007-05-091-7/+7
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2501 980ebf18-57e1-0310-9a29-db15c13687c0
* Changing the remount stuff back to not repeating the mount options.luke2007-05-011-14/+5
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2445 980ebf18-57e1-0310-9a29-db15c13687c0
* Switching the mount command to always add the mount options, so that the ↵luke2007-04-301-8/+20
| | | | | | parsed provider can be used even in cases where /etc/fstab is ignored, like it is on OS X. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2431 980ebf18-57e1-0310-9a29-db15c13687c0
* Doing more work on #113. Mostly, just making sure remounts do not happen ↵luke2007-01-291-1/+6
| | | | | | spuriously very often. They will still have extra remounts when changing the value of "ensure", but that is not currently avoidable (similar to #199). git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2109 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #113. I added support in the transaction for self-refreshing, which ↵luke2007-01-281-0/+10
| | | | | | just creates a special trigger for resources that have self-refreshing enabled. Logging is a bit different for them, so it is clear why they are refreshing. I still need to verify the remount methods work in the providers. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2107 980ebf18-57e1-0310-9a29-db15c13687c0
* I have not yet finished testing, but most of the providers now successfully ↵luke2006-12-281-3/+3
| | | | | | pass arrays to execute() instead of strings, which means that the vast majority of execution problems are now gone. I will finish testing tomorrow, hopefully, and will also hopefully be able to verify that the execution-related bugs are fixed. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1979 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing backwards compatibility in mounts -- they were not correctly copying ↵luke2006-11-161-1/+1
| | | | | | the path over to the name git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1888 980ebf18-57e1-0310-9a29-db15c13687c0
* Trying to get a netinfo provider for mounts working, but i give up. I am ↵luke2006-11-121-0/+39
leaving it in place but marked as highly experimental. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1860 980ebf18-57e1-0310-9a29-db15c13687c0