summaryrefslogtreecommitdiff
path: root/spec/unit/module_tool/applications
AgeCommit message (Collapse)AuthorFilesLines
2014-08-26PUP-2040/PE-3113 Remove symlink-ignore tests for symlinkless OSesAnderson Mills1-2/+2
Before this commit, the spec tests checked for symlink-ignore behavior on all OSes. After this commit, the spec tests only check symlink-ignore behavior on OSes that have symlinks.
2014-08-25PUP-2040/PE-3113 Ignore symlinks in module build with pmtignore.Brandon High1-1/+39
Before this commit, pmtignore functionality worked, but only after checking for symlinks, so it was impossible to ignore symlinks. This commit allows symlinks to be ignored, too.
2014-08-22(PUP-2040) .pmtignore spec testsBrandon High1-3/+271
Adding spec tests to cover build when .pmtignore/.gitignore files are present/absent
2014-07-31(PUP-2912) Puppet FS symlinks in build/unpackBrandon High2-4/+6
Prior to this commit build/unpack were trying to use the Ruby stdlib symlink to deal with symlinks. This fails on platforms (Windows) that Puppet says supports symlinks because it does not duck punch Ruby stdlib. This commit switches the specs and code for build/unpack to use Puppet FS lib's symlink functions. This should allow it to function correctly on Windows hosts that Puppet supports symlinks.
2014-07-31(PUP-2912) Build/unpack spec tests w/o symlinksBrandon High2-4/+4
Prior to this commit we would try to use symlinks in the tests on platforms that do not support symlinking. This commit uses the Puppet feature checker to conditionally try the tests if Puppet thinks the platform supports symlinks (Unixes, Linuxes, Win 2k8+).
2014-07-29(PUP-2912) Builder/unpacker spec testsBrandon High2-1/+61
Adding spec tests to check for symlinks in build/install.
2014-07-24Merge branch 'stable'Adrien Thebo1-14/+36
2014-07-23Merge pull request #2897 from highb/fix/stable/pup-2936_pmt_checksumsAnderson Mills1-14/+36
(PUP-2936) Fix checksum during PMT build (stable branch)
2014-07-23(PUP-2936) Fix checksum during PMT buildBrandon High1-14/+36
Prior to this commit `puppet module build` was checksumming the source directory and putting that in checksums.json. This commit corrects that behavior so it checksums the built module instead.
2014-07-22Merge remote-tracking branch 'upstream/stable'Josh Partlow2-0/+33
* upstream/stable: (maint) Confine enc_provides_node_when_store_configs_enabled to debian (PUP-2943) Update acceptance tests (PUP-2943) Clean ignore-changes uninstall logic (PUP-2943) Uninstall/upgrade ignore changes spec (PUP-2943) Add PMT --ignore-changes
2014-07-22(PUP-2943) Uninstall/upgrade ignore changes specBrandon High2-0/+33
Adding more spec tests for the --ignore-changes flag on uninstall/upgrade
2014-07-17(PUP-2882) Fix single available upgradeBrandon High1-0/+11
Prior to this commit `puppet module upgrade` would fail with an error message about not being able to satisfy the upgrade when there is only one published release of the module. This commit changes the error message to say that there is no version to upgrade to. This should reduce some user confusion.
2014-04-23Merge remote-tracking branch 'upstream/master' into PE-3117Pieter van de Bruggen6-448/+684
Conflicts: acceptance/tests/modules/changes/missing_metadata_json.rb lib/puppet/module_tool/applications/application.rb lib/puppet/module_tool/applications/builder.rb lib/puppet/module_tool/applications/checksummer.rb spec/unit/module_tool/applications/builder_spec.rb
2014-04-18(maint) Use PuppetSpec::Files for tmpdir creation in tests.Pieter van de Bruggen1-3/+4
Before this change, the PMT Checksummer spec was using the in-built 'tmpfile' library directly. For conformance with the rest of the test suite, it's been recommended that we should use PuppetSpec::Files for that functionality (which this change implements).
2014-04-17(PUP-2093) Improve documentation and test names.Pieter van de Bruggen3-34/+46
Prior to this commit, there were a number of places where documentation was missing and test names were insufficiently descriptive. This commit adds additional clarity around those places, and makes a couple of code clarity changes as well.
2014-04-04(PUP-2093) Migrate PMT to /v3 API.Pieter van de Bruggen6-447/+671
Prior to this commit, the PMT managed all communication with the Forge via the (now legacy) /v1 API. That API has been deprecated (primarily due to scalability concerns), which is less of an issue since it was never officially a public API. This commit migrates all communication to the Forge to the new /v3 API, which is expected to be launched as our official public API "soon". This commit also integrates a standalone dependency resolver, as the /v3 API contains no implicit dependency resolution (as the /v1 API did); consequently, large portions of the PMT code have been changed, and others have become unreachable. This commit also changes the default host that the PMT communicates with, from https://forge.puppetlabs.com to https://forgeapi.puppetlabs.com (the natural URL for the Forge API service). Since the tool now expects to communicate with a completely different service, it will be unable to communicate with services that do not implement the same /v3 API.
2014-03-18(PUP-1976) Use metadata.json as canonical metadata source.Pieter van de Bruggen2-117/+125
Prior to this commit, the Modulefile was used as the primary source of user-facing metadata for modules. This file was executable Ruby, which was intended to describe a simple data structure. This causes a few problems for us in the long-term, including making automated module builds a significantly more difficult proposition, and making changes to acceptable metadata a slow process (requiring new releases of Puppet). In addition, the only piece of Puppet code that interacted directly with the Module file was the `module build` action – anywhere we actually need to know something about the module, we look it up from the metadata.json file. This commit removes this level of indirection between user input and module data, making the metadata.json file a first-class citizen in Puppet modules. It similarly deprecates the Modulefile as a supported source of module data. Checksums have also been moved into their own file (per PE-3124), and `puppet module changes` has been updated to leverage the new file when available (per PE-3120). For users building a module containing only a Modulefile, this will issue a warning that the Modulefile is deprecated, and output the corresponding metadata.json file. For users building a module containing both a Modulefile and a metadata.json file, this will issue a warning that the Modulefile is deprecated and is being ignored.
2014-03-07Merge branch 'pr/2322'Josh Cooper1-0/+31
* pr/2322: (PUP-1563) Don't recurse when dependencies are empty (PUP-1563) resolve_install_conflicts excessively recurses Closes GH-2322
2014-03-07(PUP-1563) Don't recurse when dependencies are emptyJosh Cooper1-0/+31
Previously we would recurse for each leaf dependency unnecessarily. This commit ensures we only recurse if we have a non-empty set of dependencies, and adds a debug message when conflicts are checked. It also adds a spec tests to ensure we evaluate each module for conflicts only once. Paired-with: Josh Partlow <joshua.partlow@puppetlabs.com>
2014-02-18(PUP-1584) module_tool uses current_environment with target_dir overridesJosh Partlow3-23/+12
The module tool was relying on the implicit creation and caching of legacy environments based on puppet settings for environment and modulepath. But this does not work for the new directory style of environments. So we are being explicit about using the current environment from the context, and overriding modulepath to prepend a target_dir if given, and then directly inserting the environment to be used into the options rather than expecting the module_tool applications to retrieve the correct environment from any other loaders. Testing is now simpler, but because we are now comparing different but equal environments, I added equality and hash to node/environment to facilitate this. This in turn broke tests, because of Puppet::Node::Environment#known_resource_types which caches using the global $known_resource_types. Previously this would always clear itself when called if $known_resource_types.environment != self, but with the new node equality, state was now leaking between tests. The test_helper now sets $known_resource_types nil after each test.
2014-01-17(PUP-1118) Move global context methods to PuppetAndrew Parker2-2/+2
This moves the global context handling out of the Puppet::Context class and onto the Puppet module, which allows Puppet::Context to be a more generic, overridable context system. It also allows references to context information to be a little bit shorter. This doesn't tackle making settings information available in the context, and so there might be a little confusion between Puppet[] and Puppet.lookup.
2014-01-16(PUP-1118) Introduce "create" to make specific environmentsAndrew Parker2-32/+50
Environments are more than just a name, they are also a modulepath and a manifest. This commit makes a "create" method for setting up environments with specific modulepaths and manifests rather than relying on the Puppet Settings at the time that methods are called. In order to control environments for module installation they now take advantage of this in order to control the modulepath that things will be installed into.
2014-01-14(PUP-1118) Fetch the environment's manifest & modulepath at initAndrew Parker1-2/+2
After trying to get the manifest and modulepath during the initialization for an environment, it turned out that a lot of other things depended on a very specific load order. Some of those needed to change around, others needed to delay executing until later, after everything had been loaded and initialized (creation of the root environment was one of these). The reset of the Parser::Functions also moved so that it doesn't happen until settings have been initialized.
2013-05-16Adding a couple additional tests for supplied version constraints.Pieter van de Bruggen1-0/+20
2013-04-30(#17824) PMT should not prefer pre-release versions to existing stable versions.Pieter van de Bruggen1-2/+29
2013-04-16(#11276) Tarball entries should be relative to the `pkg` directoryJosh Cooper1-8/+9
Commit 94f2f0a9 removed the call to `Dir.chdir`, which is necessary so that entries in the tarball are relative to the `pkg` directory, i.e. each entry starts with the metadata release_name, which is of the form: myuser-mydir-X.Y.Z/ This issue was caught by the `loadable_from_modules` acceptance test as the newly installed module did not install its metadata in the expected locations. This commit restores the `Dir.chdir` behavior and updates the test.
2013-04-15(#11276) Enable module tool on WindowsJosh Cooper6-157/+102
This commit allows the module tool to run on windows and updates the spec tests as they are no longer pending.
2013-04-15(#11276) Select tar command or minitarJosh Cooper2-50/+60
Previously, the module tool relied on GNU versions of tar and gzip/gunzip to build and install modules, which isn't portable on Windows in particular. This commit adds Gnu, Solaris, and Mini tar implementations for packing and unpacking tar.gz format. It modifies the module tool to select the appropriate implementation for the platform it's currently running on. Paired-with: Andy Parker <andy@puppetlabs.com>
2013-04-03(Maint) Don't use fails_on_windows to exclude spec testsJosh Cooper2-2/+2
In the 2.7 series, we used the fails_on_windows rspec filter to exclude unit tests on windows. In 3.x, that approach has been removed. Instead, if the test should never be expected to pass on Windows, then use an exclude filter like: describe Puppet::MyClass, :unless => Puppet.features.microsoft_windows? do However, if the test doesn't currently pass, but should sometime in the future, then use an rspec conditional pending block: pending("porting to Windows", :if => Puppet.features.microsoft_windows?) do <example1> end
2013-04-03(#14728) Handle removed files in the PMT changes command.mruzicka1-0/+134
This patch ensures that "puppet module changes" command reports removed files as changed rather than exiting with a "file not found" error message when it encounters a file that should exist according to the metadata.json but which is not present. The patch also adds unit & acceptance tests for the "puppet module changes" command.
2012-08-29Maint: Use pending blockJosh Cooper2-9/+18
This commit removes the `fails_on_windows` filter in favor of a pending block. This way we document what tests don't currently pass on Windows, and it ensures that the test fails or raises. If the test runs without a problem, the test will be reported as a failure, so that we know the test is no longer pending.
2012-07-27(#15514) Add compatibility with change to operatingsystem factHailee Kenney1-2/+2
Priror to this commit, Puppet had many conditionals based of the operatingsystem fact returning `:solaris`. This fact now supports (and can return) several different version of Solaris. Change the conditionals in Puppet which rely on Solaris to rely on the osfamily fact instead, to prevent issues with this change in Facter. <hailee@puppetlabs.com>
2012-07-12(#15492) Deprecate the usage of Puppet::Util.execute in module faceKen Barber1-2/+2
The Puppet::Util.execute method is moving to Puppet::Util::Execution.execute, so to remove warning messages this patch changes the code that still uses the old methodology to the new methodology introduced in 3.x.
2012-07-11Merge commit 'ecc52ed' into 3.0rcPatrick Carlisle1-0/+61
* commit 'ecc52ed': (33 commits) (#11868) Use `Installer` automation interface to query package state Eliminate require calls at runtime. Fix broken TransBucket transformation tests. Fix broken ability to remove resources from the catalog. Fix type check when transforming catalog. Fix all trivial "should to must" errors in our tests. Enforce "must not should" on Puppet::Type instances in tests. Initialize resources strictly in backup specs Refactor file backup specs (maint) Add tags to .gitingore Use in memory sqlite database for unit tests (#14715) Use gtar with 'puppet module install' on Solaris Stub pkginfo when installing in openbsd spec (#14962) PMT doesn't support setting a relative modulepath (#15078) Document USR2 log rotation signal (#14909) Update createpackage.sh to resolve permissions issues (maint) Add --test to puppet run (maint) Add symlink stub to gentoo service provider spec Add comment to upstart provider explaining exclusion of 'wait-for-state' Upstart code cleanup, init provider improvement ... Conflicts: lib/puppet/face/module/install.rb lib/puppet/network/handler/fileserver.rb lib/puppet/parser/functions/fqdn_rand.rb lib/puppet/parser/type_loader.rb lib/puppet/ssl/base.rb lib/puppet/util.rb lib/puppet/util/autoload.rb man/man8/puppetmasterd.8 spec/lib/puppet_spec/database.rb spec/unit/face/module/install_spec.rb spec/unit/other/transbucket_spec.rb spec/unit/provider/augeas/augeas_spec.rb spec/unit/util/backups_spec.rb spec/unit/util_spec.rb
2012-07-06Merge pull request #891 from ↵Kelsey Hightower1-0/+37
kbarber/ticket/3.0rc/14598-interact_with_the_forge_using_ssl Ticket/3.0rc/14598 interact with the forge using ssl
2012-07-02(#15202) Handle paths with files in themAndrew Parker1-38/+34
When creating the install path, if there is a file in the way then there was an unhandled exception. This commit extracts out a install directory handling code for ease of testing and adds handling for this case. This class excapsulates the logic of preparing the installation directory for modules. As we find more operations on the installation directory we should try to move them to this class.
2012-06-29(#15202) Make puppet module install create parent directoriesJeff McCune1-0/+51
Without this patch, the puppet module install command will fail when run as a normal user account without a ~/.puppet directory. The error is: $ puppet module install puppetlabs-cloud_provisioner Preparing to install into /Users/jeff/.puppet/modules ... Error: Could not install module 'puppetlabs-cloud_provisioner' (latest) Directory /Users/jeff/.puppet/modules does not exist This is a problem because it adds friction to the process of getting started with Puppet. This patch fixes the problem by creating the directory if the path does not already exist. If the path does exist, then the error is still thrown, but has been modified slightly to provide helpful next actions. The error when the path exists as a non-directory looks like: Error: Could not install module 'puppetlabs-cloud_provisioner' (latest) The reason is path '/Users/jeff/.puppet/modules' is not a directory. A potential solution is `mkdir -p '/Users/jeff/.puppet/modules'`. This patch also handles the situation where the target path does not exist but the effective uid of the puppet process does not have access to create the directory. The error message in this case looks like: Error: Could not install module 'puppetlabs-cloud_provisioner' (latest) Permission is denied when trying to create directory '/Users/jeff/.puppet/modules'. A potential solution is to check the ownership and permissions of parent directories.
2012-06-28(#14715) Use gtar with 'puppet module install' on SolarisKen Barber1-0/+61
Previously we were assuming there was a usable GNU tar in the path for Solaris, but Solaris provides its own tar implementation which works quite differently. Solaris tar is also unsafe, as it allows unpacking repositories to absolute paths. This patch changes the behaviour of the unpacker code during module installation to use the 'gtar' implementation found on most Solaris 10 systems, and later part of core with Solaris 11. 'gtar' is also available on older Solaris systems from package providers such as OpenCSW and Blastwave. This also adds some unit tests for puppet/module_tool/applications/unpacker.
2012-06-27(#14598) Add SSL support for forge interactionKen Barber1-0/+37
This patch turn on SSL support when an HTTPS url is provided, and also changes the default URL to https://forge.puppetlabs.com so that now all interaction is done via SSL. As not all Ruby setups on weird operating systems are proven to work, effort was spent in making sure validation errors are captured and returned as a meaningful error to the user. This was also captured as a simple acceptance test by testing against a self-signed certificate (in our case, a puppet master). The forge error handling in Puppet::Forge::Repository was changed to return a new set of exceptions specific to the Puppet::Forge API set, so they can be captured by consumers and displayed. This also helps a lot with test mocking and tests have been changed accordingly. To reflect the new error handling in Puppet::Forge::Repository the search face was changed to capture exceptions and hand them off to the rendering parts as data in a hash, to mimic how the rest of the puppet/face/module components work. All the existing acceptance tests were changed to now test against SSL, and existing unit tests were also changed to reflect changes herein. New tests were added for Puppet::ModuleTool::Applications::Searcher as previously this had no coverage.
2012-05-11(#14387) Puppet's Module face should send a User-AgentAndrew Parker2-20/+15
The User-Agent will provide the server with some information about the version of the module tool, the version of puppet, and the version of ruby that is being used. This commit also ensures that Puppet::Forge does not depend on the Puppet::Face code. In order to achieve that the module face now is responsible for creating the correct Puppet::Forge object and handing that to the various components of the face for execution. The Puppet::Face now provides an interface for interacting with the repository in ways that various users were doing by asking for the repository directly.
2012-04-24Merge 2.7.x into master.Daniel Pittman4-15/+15
This manually fixes up a pile of Puppet Module Tool conflicts by hand, related to overlapping changes with nothing but textual translation. The rest of the merge was smooth and simple. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-04-23(#13682) Rename Puppet::Module::Tool to Puppet::ModuleToolJeff McCune4-15/+15
Without this patch, Puppet will monkey patch the existing implementation of the puppet-module Gem if it is used. This is bad because the two implementations are all jumbled up inside of one another and behavior may become unpredictable. Warnings are also displayed directly to the end user in the form of redefined constants. This patch fixes the problem by renaming Puppet::Module::Tool inside of Puppet to Puppet::ModuleTool This fixes the problem because Puppet will no longer monkey-patch the Puppet::Module::Tool module inside of the puppet-module Gem. This patch also has the added benefit of making the Module's name match up with the CamelCase filepath (puppet/module_tool/ => Puppet::ModuleTool) As a result, no file moves are necessary.
2012-04-18Use conditional pending to block out "fails_on_windows" tests.Daniel Pittman3-78/+103
A whole bunch of tests scattered through the system fail on Windows, around features that are not supported on that platform. (They are things that only the master does, which an agent-only platform doesn't need to support.) These were tagged `fails_on_windows` to allow filtering them from rspec runs, which is great, but doesn't actually communicate nearly as much useful information as it would if we used the "conditionally pending" facilities that rspec has supported since 2.3. That gives us two key things: one, it works automatically based on our knowledge of the platform, which means you can't forget to turn off failing tests. Two, it means that if the test starts unexpectedly passing we also get a failure, since we should respond to "works when it shouldn't" as seriously as "fails when it shouldn't". Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-03-30Add Module ToolMatt Robinson4-0/+467
This rather large commit includes all the work needed to get the `puppet module` face in Puppet with all it's actions. I tried to break this up into smaller commits, but it was difficult to do so and keep the individual commits in a state that had passing specs since many changes in shared module_tool code affected multiple actions. This code was developed in an integration branch over a few montsh and is now being merged back into Puppet core in the same state that shipped with Puppet Enterprise 2.5. The work here was done by Pieter van de Bruggen <pieter@puppetlabs.com>, Kelsey Hightower <kelsey@puppetlabs.com> and myself.