summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
Commit message (Collapse)AuthorAgeFilesLines
* Fixing 'puppet faces' applicationLuke Kanies2011-04-091-0/+6
| | | | | | | | | | | It only had one available method, and the errors incorrectly specified what it was. This just defaults to listing all the time, and I've updated the docs to be correct, too. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-0816-16/+16
| | | | | | | | | | | rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* maint: don't take over signal handling in tests...Daniel Pittman2011-04-081-0/+7
| | | | | | | | | We had a problem where we installed a signal handler during a :before block, which wasn't stubbed, so ended up leaving that in place forever. Which bites. We stub it out locally, which is ugly but functional. Paired-With: Matt Robinson <matt@puppetlabs.com>
* maint: Ruby < 1.8.7 knows size but not countMatt Robinson2011-04-081-4/+4
| | | | Reviewd-by: Nick Lewis
* maint: mark tests pending for a discovered bug...Daniel Pittman2011-04-081-0/+2
| | | | | | | Changes elsewhere in the tree break these two tests, but getting the merge in is worth marking them pending. :/ Paired-With: Nick Lewis <nick@puppetlabs.com>
* Merge puppet-interfaces into puppet.Daniel Pittman2011-04-076-0/+292
|\ | | | | | | | | This joins the two repositories, including full history, into a single run, as well as landing the interfaces work on the next branch ready for release.
| * (#7012) Update references in code to use face(s)Daniel Pittman2011-04-075-30/+27
| | | | | | | | | | The codebase is now using the new name, faces, uniformly to reference the objects contained. All tests pass.
| * (#7012) global rename of strings to faces.Daniel Pittman2011-04-072-0/+0
| | | | | | | | | | | | | | | | This just changes filenames and directories; files are exact copies rather than having additional modifications to make clearer each step of this process. This does leave a currently broken build. :/
| * (#6972) Handle ca-location in the certificate string.Daniel Pittman2011-04-061-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | This ports the existing certificate location configuration to be a string option, and then uses that to change the configuration. This will leak state between calls, which is somewhat unavoidable, but should at least get the basic stuff right for the CLI. We eventually need the CA string to be supported by a stateless internal CA implementation that allows us to do the right thing overall. Reviewed-By: Dan Bode <dan@puppetlabs.com>
| * (#6972) Recognize puppet global options in pre-parse.Daniel Pittman2011-04-061-0/+29
| | | | | | | | | | | | | | | | | | | | This extends the CLI pre-parse phase to identify both string *and* global options out of the Puppet settings/defaults system. This makes the regular CLI support for setting Puppet configuration globals work as expected. This moves us along the line of supporting these options more fully. Reviewed-By: Dan Bode <dan@puppetlabs.com>
| * (#6949) Fix passing positional arguments to actions.Daniel Pittman2011-04-041-0/+6
| | | | | | | | | | | | | | | | We had a logic failure that didn't pass positional arguments at all, but which our testing didn't verify. This entirely broke things. Now fixed, and a test added to ensure we don't bug out further... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6964) use 'when_invoked' rather than 'invoke' for actions.Daniel Pittman2011-04-041-1/+1
| | | | | | | | | | | | | | In the DSL we want to use 'when_invoked do' because it reads much more naturally for users. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) Handle options with inline arguments.Daniel Pittman2011-04-041-0/+6
| | | | | | | | | | | | | | We didn't correctly handle '--foo=bar' as having supplied an argument during the pre-parse phase. Now we have a test for it, and a fix in the code. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * (#6749) Extract the action from the arguments cleanly.Daniel Pittman2011-04-041-0/+8
| | | | | | | | | | | | | | | | | | This adds a test to verify that we are correctly removing the action name from the set of arguments passed to the string action, then cleans up the previous code so we don't need to mutilate the command line arguments: we can just extract it from the resultant set of information. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * (#6749) Fix optional vs mandatory argument handling.Daniel Pittman2011-04-041-8/+27
| | | | | | | | | | | | | | | | | | | | optparse will treat '--foo --bar' as "foo with the argument --bar" when foo takes a mandatory argument. We need to emulate that behaviour in our pre-parse of the command line. Incidentally, fix up a bug in boolean options, and improve our testing. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| * (#6749) Polish the CLI option pre-parse implementationDaniel Pittman2011-04-041-49/+16
| | | | | | | | | | | | | | | | | | | | This improves handling of the pre-parse of the command line to be non-destructive, which cuts down the volume of garbage generated in the process. It also improves testing to verify that we get the darn thing right... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) clean up various testing bits...Daniel Pittman2011-04-041-11/+19
| | | | | | | | | | | | | | This cleans up a whole bunch of bits of the testing code around the place; nothing revolutionary, just nicer and more robust code. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6760) set terminus in indirector string base class.Daniel Pittman2011-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | We now accept a terminus option to each invocation, and set the terminus based on that call. This is probably incomplete, because it only sets the terminus when given, and doesn't try to reset it to the default afterwards. This also resets the terminus class after every invocation, to stop it leaking state across calls. This make, sadly, have some effects if you are not just using the strings to invoke the terminus, but it beats having the strings broken as well... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) Start porting existing strings to the options API.Daniel Pittman2011-04-041-0/+0
| | | | | | | | | | | | | | | | This provides a solid test of the new code, by migrating the existing strings to match. This also gives us a chance to determine any weak points in the code as written. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) code and test cleanup of Application/StringBase.Daniel Pittman2011-04-041-5/+12
| | | | | | | | | | | | | | This removes dead code now we have terminus in the base string, and disables some tests on StringBase app until they can be rewritten. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) string cli base: implement preinit CLI parsingDaniel Pittman2011-04-041-8/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to identify the full set of options we need to know the action that is being invoked; that actually requires a pre-processing step to identify that out of the global options. Notably, our spec is that options can be to the right of their declaration point, but not to the left: that means that we can now extract the full set of options, and interact with the standard Puppet option handling code, resulting in at least vaguely saner behaviour... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6749) implementing option handling in CLI string wrapperDaniel Pittman2011-04-041-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of this is to adapt the generic option support in our strings to the command line; we adapt the generic option information to optparse, and establish our environment early in the process to ensure that we can play nice with Puppet::Application for the moment. In the process we ensure that we detect, and report, conflicts in option naming across the board. Additionally, when an option is declared with multiple aliases, we insist that either all, or none, of them take an argument. To support this we support introspecting options having an optional argument, as well as documentation and all. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * (#6758) Pass options as an argument to string actions.Daniel Pittman2011-04-021-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier in their implementation the String prototype would set global state on a String object to reflect options set on the command line. As we move strings away from a CLI-only prototype, this becomes troublesome because we can easily have, for example, HTTP access to a string, which means load balancers can really make this confusing. It also encourages global state pollution, where one invocation can adversely influence another. A better approach is that we pass options to the string action invocation directly; this makes the interaction stateless. Changes required to your code to adapt to the new world: - action(:foo) do |some, args| + action(:foo) do |some, args, options={}| if options[:whatever] then Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * MAINT: delete a test that can't work on 2.6.Daniel Pittman2011-04-021-5/+0
| | | | | | | | | | | | | | | | The methods being tested are not available in the 2.6 series, and the test itself is relatively weak, so rather than try to fix it we eliminate it in favour of other testing of the same behaviour. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * MAINT: implement a pending test for code we wrote...Daniel Pittman2011-04-021-1/+11
| | | | | | | | | | | | | | We had an outstanding pending test for code we wrote, and which we were not actually testing stand-alone. This implements the test for that. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| * maint: Use bracket notation instead of define in specsNick Lewis2011-03-291-0/+0
| | | | | | | | | | | | | | | | The intent of these specs is to find the String rather than to actually define it. Thus, the bracket notation is more semantically accurate than using Puppet::String#define. Reviewed-By: Pieter van de Bruggen
| * (#6770) Change versioning; adopt :current over :latest.Pieter van de Bruggen2011-03-281-7/+8
| | | | | | | | | | | | | | | | | | | | | | As per discussion with Luke, versions of an interface are first looked up by requiring 'puppet/interface/{name}', and secondarily looked up by requiring '{name}@{version}/puppet/interface/{name}' if the first failed. A version of `:current` can be used to represent the version living in 'puppet/interface/{name}'. Paired-With: Nick Lewis
| * MAINT: the API is officially named "string" as of this moment.Daniel Pittman2011-03-285-26/+26
| | | | | | | | | | | | | | Now that we have settled on the final public name for the API, "Puppet::String", mass-rename and mass-edit all the files to follow. Reviewed-By: Randall Hansen <randall@puppetlabs.com>
| * (#6770) Add support for version :latest.Pieter van de Bruggen2011-03-251-1/+13
| | | | | | | | | | | | | | | | | | Specifying a version of `:latest` will find the most recent version of the named interface installed in your RUBYLIB, and attempt to load that. This is unlikely to provide a stable dependency in the future, so should be used sparingly, acknowledging the dangers. Reviewed-By: Daniel Pittman
| * Merge branch 'tickets/master/6770'Pieter van de Bruggen2011-03-231-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/interface/certificate.rb spec/unit/application/interface_base_spec.rb spec/unit/interface/interface_collection_spec.rb
| | * (#6770) Rename Puppet::Interface::interface method.Pieter van de Bruggen2011-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | Puppet::Interface::interface is now Puppet::Interface::define, also aliased to Puppet::Interface::[] for convenience. Paired-With: Nick Lewis
| | * (#6770) Changing versioning to semver.Pieter van de Bruggen2011-03-231-1/+1
| | | | | | | | | | | | | | | | | | More information about the versioning scheme can be found at http://semver.org. Paired-With: Nick Lewis
| | * (#6770) Add basic versioning for interfaces.Pieter van de Bruggen2011-03-231-1/+1
| | | | | | | | | | | | Reviewed-By: Nick Lewis
| * | Factoring cert status app back into certificate.Richard Crowley2011-03-231-0/+21
| | |
| * | maint: Fix order-dependent spec failuresNick Lewis2011-03-221-5/+4
| |/ | | | | | | | | | | | | | | | | The specs for InterfaceCollection were clearing the list of interfaces at the end of the spec run, which caused later specs to fail because they couldn't re-require interfaces they needed. This fixes the InterfaceCollection specs to save and restore the interfaces at the end of the file. Reviewed-By: Matt Robinson
| * maint: Implement an InterfaceCollection class to manage interfacesNick Lewis2011-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | Having an instance variable on class Interface is insufficient for Interface::Indirector. This also changes the semantics of "Interface.interface" to handle registration and loading actions, and for "Interface.new" to only instantiate an Interface. Thus, consumers of the API should typically use "Interface.interface", unless they have reasons to not want an interface automatically registered. Paired-With: Pieter van de Bruggen
| * (#6805) Add a "configurer" applicationNick Lewis2011-03-211-0/+31
| | | | | | | | | | | | | | | | | | This application is similar in basic functionality to the "agent" application, but implemented in terms of interfaces. It currently will retrieve facts, retrieve a catalog, apply the catalog, and submit a report. Options such as noop and daemonize are still to come. Reviewed-By: Pieter van de Bruggen
| * Adding a test for fix to #14Luke Kanies2011-03-021-3/+3
| | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Fixing plugin usageLuke Kanies2011-02-241-0/+12
| | | | | | | | | | | | | | | | | | I had broken some usages of plugins by incorrectly selecting command-line arguments. The fix was to remove the #main method contained in the IndirectionBase subclass. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Adding Application options to InterfacesLuke Kanies2011-02-231-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | This allows all of the actions to react to the CLI options. I've also removed the unnecessary 'name' variables I was using in various places - they were just the first of the arguments, and they weren't actually always names. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Adding render and exit_code override supportLuke Kanies2011-02-221-1/+28
| | | | | | | | | | | | | | This is mostly in response to feature requests from Dan. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Fixing 'puppet interface list'Luke Kanies2011-02-221-0/+10
| | | | | | | | | | | | | | Also added a test to hopefully confirm it won't break again. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Adding a simple "config" appLuke Kanies2011-02-221-0/+10
| | | | | | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
| * Splitting the Application base classLuke Kanies2011-02-222-0/+21
| | | | | | | | | | We now have an indirection_base class along with interface_base. I've also added some basic tests for most of the interfaces. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Merge branch '2.6.x' into nextMax Martin2011-03-301-2/+2
|\ | | | | | | | | | | | | * 2.6.x: (#5908) Add support for new update-rc.d disable API (#6862) Add a default subject for the mail_patches rake task Fixed #6256 - Creation of rrd directory.
| * Fixed #6256 - Creation of rrd directory.James Turnbull2011-03-261-2/+2
| | | | | | | | Added :metrics to the settings used by the master
* | maint: Silence test output in the spec runMatt Robinson2011-03-181-2/+3
| | | | | | | | | | | | | | | | There was a test that output 'false' in the middle of the spec run. This fixes that and makes the test a little stronger, because we actually assert what puts is writing to standard out. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.6.next' into nextMatt Robinson2011-03-076-30/+77
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a particularly nasty merge, so rather than hold up merges into next any longer, I'm going to push this merge with a few outstanding problems. The tests that were failing in the following areas have been marked pending, and will be addressed separately, immediately following this push. TODO: Verify that brice's rdoc change is still valid: tests to show that line numbers from class, define and node get into the ast Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb * 2.6.next: (85 commits) (#5148) Fix failing spec due to timezone (#5148) Add support for PSON to facts (#6338) Remove inventory indirection, and move to facts indirection (#6445) Fix inline docs: puppet agent does not accept --mkusers Update CHANGELOG and version for 2.6.6rc1 (#6541) Fix content with checksum truncation bug (#6418) Recursive files shouldn't be audited (#6541) maint: whitespace cleanup on the file integration spec (#6541) Fix content with checksum truncation bug (#5466) Write specs for output of puppet resource (#5466) Monkey patch Symbol so that you can sort them (#5466) Fixed puppet resource bug with trailing , Update CHANGELOG for 2.6.5 (#4922) Don't truncate remotely-sourced files on 404 (#6338) Remove unused version control tags Maint: Align tabs in a code block in the Augeas type. (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type Maint: Rewrite comments about symlinks to reflect best practice. (#6509) Inline docs: Fix broken lists in Launchd provider. (#6509) Inline docs: Fix broken code blocks in zpool type ... Manually Resolved Conflicts: lib/puppet/application/inspect.rb lib/puppet/defaults.rb lib/puppet/file_bucket/dipper.rb lib/puppet/network/http/handler.rb lib/puppet/node/facts.rb lib/puppet/parser/parser.rb lib/puppet/parser/parser_support.rb lib/puppet/util/command_line/puppet lib/puppet/util/command_line/puppetd lib/puppet/util/command_line/puppetmasterd lib/puppet/util/monkey_patches.rb lib/puppet/util/rdoc/parser.rb spec/unit/application/agent_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector/file_bucket_file/file_spec.rb spec/unit/network/http/handler_spec.rb spec/unit/parser/parser_spec.rb spec/unit/provider/mount/parsed_spec.rb
| * (#6322) --noop should not suppress error codesJesse Wolfe2011-02-252-2/+18
| | | | | | | | | | | | | | | | | | The noop option has been suppressing exit statuses. This is counterintuitive, as per discussion at http://projects.puppetlabs.com/issues/6322 This patch causes noop runs to return the same exit codes as real runs. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
| * (#5552) Display help when no subcommand is given.Daniel Pittman2011-02-221-0/+10
| | | | | | | | | | | | | | | | | | Previously, when the command line was empty we would try and invoke an empty method; this was less helpful than telling people what they could actually do, so we adapt our code to do precisely that. Paired-With: Jesse Wolfe <jesse@puppetlabs.com> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>