summaryrefslogtreecommitdiff
path: root/spec/unit/module_tool
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-08-01Merge pull request #2851 from highb/fix/master/pup-2745_forge_dependency_fixAnderson Mills1-2/+57
PUP-2745 Forge malformed dependency fix
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-28(PUP-2901) Add module dependency validationBrandon High1-2/+57
Prior to this commit there wasn't much verification for module dependencies. This commit adds verification the module dependencies have sane names and version ranges. If verification fails, it will raise an argument exception.
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-22Merge pull request #2885 from ↵Anderson Mills1-0/+11
highb/fix/master/pup-2882_upgrade_broken_for_one_version (PUP-2882) Fix single available upgrade
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-17Merge pull request #2874 from adrienthebo/maint/master/update-rspecAndrew Parker1-2/+2
Maint/master/update rspec
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-07-16Merge pull request #2872 from highb/fix/master/pup-1186_pax_headerAnderson Mills1-1/+2
(PUP-1186) Ignore PAX header in tar unpacking
2014-07-15(maint) Avoid rspec examples using variable behaviorAdrien Thebo1-2/+2
Given an object with an attr_accessor and using an example shortcut like so: subject { metadata.to_hash } its(:keys) do subject.sort.should == %w[ name version author summary license source issues_url project_page dependencies ].sort end The value of subject in the example varies between RSpec 2.11 and 2.13. This commit removes the shortcut in favor of a slightly longer but more compatible test that explicitly invokes the #keys method and does an expectation on that.
2014-07-14(PUP-1186) Ignore PAX header in tar unpackingBrandon High1-1/+2
Prior to this commit if you installed a puppet module built on a platform with a tar implementation that adds PAX headers and your platform didn't have a native tar implementation (Windows), the module would contain junk PaxHeader directories. This is due to the default POSIX behavior programmed in to minitar (the ruby tar implementation used for platforms with out native tar) for an unknown typeflag, such as those used in PAX headers, is to treat it as a regular file and extract it. This commit adds a pre-scan step to our use of minitar for unpacking that finds all the files with standard typeflags (0-7) and then only unpacks those, thus ignoring any Pax typeflags like 'x' or 'g'.
2014-07-02(PUP-2752) Fix for invalid semversBrandon High1-0/+49
Prior to this commit the module tool would fail to perform any actions if any module found in the modulepath had an invalid semver. This commit warns about invalid semvers in installed modules, sets the version to 0.0.0, and moves on. This allows the module tool to continue to work, even with the invalid semver found in the path. This commit also adds some rudimentary tests for the Puppet::ModuleTool::InstalledModules class.
2014-05-28(PUP-2691) Re-adding the missing ‘description’ property to P::MT::Metadata.Pieter van de Bruggen1-0/+13
Prior to Puppet 3.6.0, users had a ‘description’ property which they could reliably expand into their module skeleton’s ERB templates. This property was removed from the default set of properties in Puppet 3.6.0, which effectively broke template expansion for users relying on it. This change ensures that users can continue to rely on this property.
2014-05-14(PUP-2561) Fix spec test on windowsKylo Ginsberg1-1/+1
2014-05-13(PUP-2561) Revert to using UNIX pipes in PMT’s tar operations.Pieter van de Bruggen1-7/+5
Prior to this change, we’d attempted to handle shell escaping of arguments by passing arrays of arguments rather than a single full command string. While this worked as intended, it meant that we needed to stream data between processes through Ruby. As it happens, larger tarballs would cause the write pipeline to become backed up, and since we would attempt to write all the data before reading any, we would effectively deadlock. Rather than attempting to stream by chunks, we’ve reverted back to using the full string commands, and managing shell escapes (where needed) in Ruby.
2014-04-24(Maint) Don't expand tar cf - sourcedir pathJosh Cooper1-1/+1
The Gnu tar implementation executes `tar cf - #{sourcedir}`, which can be a relative path. So it is not necessary to expand it, and doing so causes the test to fail on windows.
2014-04-24(maint) Adding File.expand_path to the Tar::Gnu specs.Pieter van de Bruggen1-6/+6
Prior to this commit, the specs made assertions about absolute file paths, which works perfectly until you try running the tests under Windows. This change patches the tests so that they will continue to run properly under both Windows and Linux.
2014-04-23Merge pull request #2555 from ↵Nick Lewis1-9/+11
pvande/bug/master/pup2278_fix_pmt_handling_of_paths_with_spaces Accept paths with spaces in PMT tarball interactions.
2014-04-23Merge pull request #2538 from ↵Nick Lewis1-2/+57
pvande/task/master/pup2284_puppet_module_generate_interview Add an interview to the PMT `generate` action.
2014-04-23Merge remote-tracking branch 'upstream/master' into PE-3117Pieter van de Bruggen8-453/+689
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-21(PUP-2278) Parameterize the mode of Puppet::Util::Execution.execpipe.Pieter van de Bruggen1-2/+2
In the previous commit, the default behavior of `execpipe` was changed to ensure that the pipe was always opened in read/write mode. While we aren't aware of any regressions this change would cause, the cautious route is to maintain the same default behavior for now; to that end, this commit adds a `mode` parameter to `execpipe`, allowing callers to choose the mode the pipe is opened in.
2014-04-18(maint) Fix metadata validation for missing namespaces and module names.Pieter van de Bruggen1-0/+16
Prior to this commit, validation would raise non-sensical validation errors if you attempted to validate a module name that contained a separator (either '-' or '/'), but less than one character on either side. This change adds validation for those cases.
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-18(maint) Refactoring module name validation to be less obtuse.Pieter van de Bruggen1-1/+1
Previously the code that validated module names took a pessimistic approach, validating conformance only to assert unrelated non-conformance. As it turns out, this is messy to read and understand, so this change rewrites the logic in a more straightforward manner.
2014-04-18(PUP-2278) Accept paths with spaces in PMT tarball interactions.Pieter van de Bruggen1-9/+11
Prior to this commit, if the module_working_dir or the path to a module being built contained whitespace, our simple string-interpolation would fail to create a valid call to `tar` or `gzip`. This change fixes the bugs resulting from that behavior.
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-16(PUP-2284) Add an interview to the PMT `generate` action.Pieter van de Bruggen1-2/+57
Prior to this commit, when you generated a new module, it created a simple metadata.json file with the same standard defaults for every module. Since JSON may not be the most familiar language for all of our users, we now do some work up front to pre-fill that JSON file with useful data based on user input.
2014-04-04(PUP-2093) Migrate PMT to /v3 API.Pieter van de Bruggen8-452/+676
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 Bruggen3-131/+277
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-12Merge pull request #2378 from reidmv/fix_moduletool_tar_non_gnuAdrien Thebo3-37/+2
(PUP-1749) Fix module_tool extract for non-gnu tar
2014-03-07Remove now-redundant Tar::Solaris from module_toolReid Vandewiele2-36/+0
Changes to the way Puppet::ModuleTool::Tar::Gnu works means that the *::Tar::Solaris variant should now be redundant. It existed to require gtar when the underlying platform did not support GNU-tar options, but the changes to the core Tar::Gnu class mean that we no longer use any flags or options that don't work just fine with oldschool unix tar executables. Remove Puppet::ModuleTool::Tar::Solaris. On a side note, Tar::Gnu should probably be renamed to something more generic.
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-22Add tests for module_tool changesReid Vandewiele1-1/+2
I'm not entirely sure if I'm using #yields() correctly but this allows me to expect that Dir.chdir is called, and still expect all the calls to Puppet::Util::Execution.execute to be made.
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-24(PUP-1151) Respond with 404 when path not knownAndrew Parker1-1/+1
The v2.0 api implementation had a type that was not caught by any tests. This fixes that issue (a typo) and adds a test that would have shown the problem.
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-11-13(#9546) Fix up the solaris gtar specKylo Ginsberg1-2/+2
2013-11-11(#9546) Update test to reflect changed permissionsAndrew Parker1-2/+2
2013-11-08(22853) Let OpenBSD use gtar too.Jasper Lievisse Adriaanse1-0/+45
BSD tar doesn't support "--no-same-permissions --no-same-owner" Tests and minor fixups by Adrien Thebo <adrien@puppetlabs.com>