summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* (#6338) Remove unused version control tagsMatt Robinson2011-02-281-2/+0
| | | | | | | Older version control systems like CVS and SVN used to use these $Id$ tags for version information. Paired-with: Nick Lewis
* (#6331) Inline documentation: Fix rotted links pointing at the Trac wikinfagerlund2011-02-151-2/+2
| | | | | This patch updates links in three files and marks a link in a fourth file as unrecoverable.
* Fixes errant Trac references in documentationJames Turnbull2010-07-152-2/+2
|
* Code smell: Two space indentationMarkus Roberts2010-07-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Use string interpolationMarkus Roberts2010-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 83 occurances of (.*)" *[+] *([$@]?[\w_0-9.:]+?)(.to_s\b)?(?! *[*(%\w_0-9.:{\[]) with \1#{\2}" 3 Examples: The code: puts "PUPPET " + status + ": " + process + ", " + state becomes: puts "PUPPET " + status + ": " + process + ", #{state}" The code: puts "PUPPET " + status + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" The code: }.compact.join( "\n" ) + "\n" + t + "]\n" becomes: }.compact.join( "\n" ) + "\n#{t}" + "]\n" * Replaced 21 occurances of (.*)" *[+] *" with \1 3 Examples: The code: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}, #{state}" The code: puts "PUPPET #{status}" + ": #{process}, #{state}" becomes: puts "PUPPET #{status}: #{process}, #{state}" The code: res = self.class.name + ": #{@name}" + "\n" becomes: res = self.class.name + ": #{@name}\n" * Don't use string concatenation to split lines unless they would be very long. Replaced 11 occurances of (.*)(['"]) *[+] *(['"])(.*) with 3 Examples: The code: o.define_head "The check_puppet Nagios plug-in checks that specified " + "Puppet process is running and the state file is no " + becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + The code: o.separator "Mandatory arguments to long options are mandatory for " + "short options too." becomes: o.separator "Mandatory arguments to long options are mandatory for short options too." The code: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + "older than specified interval." becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no older than specified interval." * Replaced no occurances of do (.*?) end with {\1} * Replaced 1488 occurances of "([^"\n]*%s[^"\n]*)" *% *(.+?)(?=$| *\b(do|if|while|until|unless|#)\b) with 20 Examples: The code: args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") becomes: args[0].split(/\./).map do |s| "dc=#{s}" end.join(",") The code: puts "%s" % Puppet.version becomes: puts "#{Puppet.version}" The code: raise "Could not find information for %s" % node becomes: raise "Could not find information for #{node}" The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file" The code: Puppet.err "Could not run %s: %s" % [client_class, detail] becomes: Puppet.err "Could not run #{client_class}: #{detail}" The code: raise "Could not find handler for %s" % arg becomes: raise "Could not find handler for #{arg}" The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}" The code: raise Puppet::Error, "Could not deserialize catalog from pson: %s" % detail becomes: raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}" The code: raise "Could not find facts for %s" % Puppet[:certname] becomes: raise "Could not find facts for #{Puppet[:certname]}" The code: raise ArgumentError, "%s is not readable" % path becomes: raise ArgumentError, "#{path} is not readable" The code: raise ArgumentError, "Invalid handler %s" % name becomes: raise ArgumentError, "Invalid handler #{name}" The code: debug "Executing '%s' in zone %s with '%s'" % [command, @resource[:name], str] becomes: debug "Executing '#{command}' in zone #{@resource[:name]} with '#{str}'" The code: raise Puppet::Error, "unknown cert type '%s'" % hash[:type] becomes: raise Puppet::Error, "unknown cert type '#{hash[:type]}'" The code: Puppet.info "Creating a new certificate request for %s" % Puppet[:certname] becomes: Puppet.info "Creating a new certificate request for #{Puppet[:certname]}" The code: "Cannot create alias %s: object already exists" % [name] becomes: "Cannot create alias #{name}: object already exists" The code: return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum] becomes: return "replacing from source #{metadata.source} with contents #{metadata.checksum}" The code: it "should have a %s parameter" % param do becomes: it "should have a #{param} parameter" do The code: describe "when registring '%s' messages" % log do becomes: describe "when registring '#{log}' messages" do The code: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l } becomes: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration#{l}test" } The code: assert_raise(Puppet::Error, "Check '%s' did not fail on false" % check) do becomes: assert_raise(Puppet::Error, "Check '#{check}' did not fail on false") do
* Fixes #3460 - Makes Puppet FHS compliant by moving /var/puppet to ↵James Turnbull2010-02-171-5/+5
| | | | /var/lib/puppet
* deprecate NetInfo providers and examples, remove all NetInfo references and ↵Nigel Kersten2009-07-141-5/+0
| | | | tests.
* Removed extra whitespace from end of linesIan Taylor2009-06-065-8/+8
|
* Changed tabs to spaces without interfering with indentation or alignmentIan Taylor2009-06-065-335/+335
|
* type/mcx.rb Feature #1026 - MCX TypeJeffrey McCune2008-12-016-0/+378
| | | | | | | | Added new MCX type and base test. This type manages MCX settings on DirectoryService nodes. These settings take the form of plist XML documents attached to Users, Groups, and Computers in DirectoryService.
* Further moves from the examples directory and ext directoryJames Turnbull2008-07-156-0/+116
|
* Moved debian to conf and updated examples directoryJames Turnbull2008-07-1038-283/+0
|
* Changed some non-standard Ruby locations to env ruby shebangsJames Turnbull2008-04-041-1/+1
|
* Fixed #1028 - examples incorrect for 0.24.xJames Turnbull2008-01-282-7/+6
|
* Added optional per-module lib directory.Jeffrey J McCune2007-08-145-0/+80
| | | | | | | | Puppet now looks for a lib directory inside each module bundle, and adds the directory to the list searched by Puppet::Util::Autoload. The intent is to facilitate more sophisticated virtual types and flexibility within modules.
* DirectoryService provider for users and groups. Alternative to netinfo, as ↵mccune2007-08-034-0/+66
| | | | | | | | apple has indicated NetInfo may go away at some point in the future. It might happen in October. FIXME: implement groups and groups= instances methods for Puppet::Type::User::ProviderDirectoryservice git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2739 980ebf18-57e1-0310-9a29-db15c13687c0
* Fix for #565: Final merge of changes from source:branches/execute-refactor ↵mccune2007-04-031-0/+16
| | | | | | | | | | | | | | | into source:trunk Generated with svn merge -r 2378:HEAD https://reductivelabs.com/svn/puppet/branches/execute-refactor trunk CHANGES: - Puppet::Util#execute now takes hash key/value pairs as arguments after the command array. - Processes executed from the base service provider are now silenced. That is, their standard input, output, and error pipes are all directed to /dev/null. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2385 980ebf18-57e1-0310-9a29-db15c13687c0
* exiting sleeper after no more than two minutesluke2006-12-291-5/+3
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1992 980ebf18-57e1-0310-9a29-db15c13687c0
* adding a comment to namespaceauth.confluke2006-11-121-0/+3
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1862 980ebf18-57e1-0310-9a29-db15c13687c0
* adding up-to-date example configsluke2006-11-125-11/+40
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1861 980ebf18-57e1-0310-9a29-db15c13687c0
* Merging the changes from the override-refactor branch. This is a ↵luke2006-10-0433-507/+0
| | | | | | significant rewrite of the parser, but it has little affect on the rest of the code tree. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1726 980ebf18-57e1-0310-9a29-db15c13687c0
* Removing a test in the parser that is no longer necessary because of how ↵luke2006-09-151-2/+2
| | | | | | imports work now, and fixing a snippet not to interfere with a local fact git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1606 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding hasrestart parameter to servicesluke2006-09-051-0/+6
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1569 980ebf18-57e1-0310-9a29-db15c13687c0
* Tracking down some weird bugs that managed to creep into the parser. I ↵luke2006-08-281-1/+1
| | | | | | expect that the main ones were a result of the If support. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1494 980ebf18-57e1-0310-9a29-db15c13687c0
* Finishing changes to support titles instead of two types of names. This is ↵luke2006-08-174-4/+4
| | | | | | basically a bug-fix commit. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1472 980ebf18-57e1-0310-9a29-db15c13687c0
* Merging r1468 from the implementations branch with r1438 from when the ↵luke2006-08-141-1/+1
| | | | | | branch was first created. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1469 980ebf18-57e1-0310-9a29-db15c13687c0
* removing classing example, since it involves parameterized classesluke2006-08-071-35/+0
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1450 980ebf18-57e1-0310-9a29-db15c13687c0
* Another batch of bug fixes, this time focused on OS X patches. Looks like I ↵luke2006-07-221-1/+2
| | | | | | did not test on os x last time. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1422 980ebf18-57e1-0310-9a29-db15c13687c0
* Apparently objects were legal rvalues, which does not make any sense. Fixed ↵luke2006-07-211-0/+1
| | | | | | this, and added a test verify. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1418 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding test and fix for empty execs being ignoredluke2006-06-151-0/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1288 980ebf18-57e1-0310-9a29-db15c13687c0
* Found a bug where single-value selectors can fail on a second compile. ↵luke2006-06-091-1/+6
| | | | | | Fixed it, and am now compiling all snippets twice. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1250 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #141. It was a problem related to the recent parser changes I made.luke2006-05-121-0/+23
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1185 980ebf18-57e1-0310-9a29-db15c13687c0
* It is just a snippet test, and thus a functional test but not a coverage ↵luke2006-05-091-0/+17
| | | | | | test, but definition overrides officially work. This was important because it enables definitions to be collectable, which was not possible without the mechanism that enables this. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1181 980ebf18-57e1-0310-9a29-db15c13687c0
* This should have been in 0.16.1. Moving the "setclass" statements around so ↵luke2006-04-261-0/+10
| | | | | | that classes are set before a given class's code is evaluated, so it can be tested within the code, within node defs, components, or classes. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1139 980ebf18-57e1-0310-9a29-db15c13687c0
* Creating a simplistic, generic function framework in the parser, so it is ↵luke2006-04-261-0/+25
| | | | | | now very easy to add new functions. There is a pretty crappy, hardwired distinction between functions that return values and those that do not, but I do not see a good way around it right now. Functions are also currently responsible for handling their own arity, although I have plans for fixing that. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1134 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing a bunch of small bugs, mostly found by testing on solaris, and added ↵luke2006-04-171-0/+0
| | | | | | a check to the test system that points out memory growth git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1113 980ebf18-57e1-0310-9a29-db15c13687c0
* changing set to tag in the testsluke2006-04-131-2/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1112 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing the language side of #109. Added a "set" keyword.luke2006-04-111-0/+9
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1103 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #117. If only one value was provided, then it was not placed in an ↵luke2006-04-101-0/+22
| | | | | | array, yet AST::Selector expected an array. The grammar needs to have some abstraction added or something, because I seem to have encountered this bug for every ast type that supports arrays internally. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1097 980ebf18-57e1-0310-9a29-db15c13687c0
* Supporting variables as the test value in both case statements and selectors.luke2006-03-032-0/+26
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@976 980ebf18-57e1-0310-9a29-db15c13687c0
* renamingluke2006-03-031-0/+0
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@975 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding single-quote syntactical elementluke2006-02-161-0/+11
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@923 980ebf18-57e1-0310-9a29-db15c13687c0
* Making the language name a real alias. Now all objects in Puppet support ↵luke2006-02-101-0/+16
| | | | | | specifying both the name and the namevar, or just a name and having the namevar set. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@896 980ebf18-57e1-0310-9a29-db15c13687c0
* committing test code for bug lutter foundluke2006-02-071-0/+11
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@867 980ebf18-57e1-0310-9a29-db15c13687c0
* Made lots of small changes, mostly to help usability but also fixed a couple ↵luke2006-01-182-0/+28
| | | | | | of key bugs git-svn-id: https://reductivelabs.com/svn/puppet/trunk@841 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding an "ensure" state where appropriate, and significantly reworking the ↵luke2006-01-1723-58/+58
| | | | | | builtin docs. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@832 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixed a couple of warnings, fixed a critical bug having to do with case ↵luke2006-01-121-0/+8
| | | | | | statements (where there is only one listed option), and did a couple of other cleanups. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@814 980ebf18-57e1-0310-9a29-db15c13687c0
* Merging changes from the head of the rework1 branch, r 784luke2006-01-081-1/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@787 980ebf18-57e1-0310-9a29-db15c13687c0
* Undoing the merge that happened in 785luke2006-01-071-2/+1
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@786 980ebf18-57e1-0310-9a29-db15c13687c0
* Merging in refactoring from version 774 into version 784luke2006-01-071-1/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@785 980ebf18-57e1-0310-9a29-db15c13687c0