summaryrefslogtreecommitdiff
path: root/spec/unit/forge
AgeCommit message (Collapse)AuthorFilesLines
2014-08-06(PUP-3019) Make PMT check for string status codes when downloadingAlex Dreyer1-3/+2
Previously PMT was checking for integer status codes when downloading modules. This results in all module downloads failing. After this PMT will check for string status codes when downloading modules.
2014-08-05(PUP-3009) Add error handling to PMT module downloadsAlex Dreyer2-7/+11
Before this PMT would not check if the module download request succeeded before trying install the module. This causes informative errors from forge to be hidden by an error about the checksum of the download not matching. After this PMT will only move forward with module installation if a 200 is received from forge otherwise it will display the error returned by forge.
2014-07-30(PUP-2745) Ignore malformed forge dependenciesBrandon High1-89/+173
Prior to this commit a malformed name in the dependencies for a downloaded forge module dependency would cause the PMT to fail unexpectedly. This commit causes the PMT to ignore malformed dependencies.
2014-07-14(PUP-2920) Make PMT authenticate with forge and request extra modules.Alex Dreyer1-0/+14
Before this PMT only supported basic authentication which the Puppet Forge does not. This adds the ability to configure other authentication methods and request that forge include extra module groups in responses.
2014-07-02(PUP-2869) Puppet should support HTTP proxy authenticationbeergeek1-2/+96
Without this patch it is not possible to use the Puppet Module Tool (PMT) with an authenticated proxy. Many enterprises utilise the services of authenticated proxies for Internet access. Current code is able to utilise a proxy, but does not consider credentials for authenticated proxies. This patch uses the credentials from either the environment settings for HTTP_PROXY or http_proxy, or the corresponding values in the puppet.conf file. The patch allows for http_proxy_user and http_proxy_password to supplement the current http_proxy_host and http_proxy_port variables within the puppet.conf.
2014-04-04(PUP-2093) Migrate PMT to /v3 API.Pieter van de Bruggen2-20/+152
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-01-17(Maint) Unravel require of forge codeAndrew Parker2-4/+2
This changes it so that the puppet/forge file handles pulling in all of the forge related code and thereby sidesteps all sorts of load order issues.
2013-07-16(#21785) Module tool should include path part of URIErik Dalén1-3/+12
The module tool ignored the path part of the URI when specifying a custom module_repository setting. Example: puppet module install foo-bar --module_repository=‘http://forge.example.com/forge’ fetched http://forge.example.com/api/v1/releases.json?module=foo/bar instead of http://forge.example.com/forge/api/v1/releases.json?module=foo/bar Same issue when it tries to fetch the file itself.
2013-07-04(#16635) Respect http_proxy environment and settings in pkgdmgClay Caviness1-29/+0
In 3.x, the pkgdmg provider no longer honors http_proxy_host or http_proxy_port settings or environment variables. This takes the methods to do this from puppet/forge/repository and puts them in puppet/util/http_proxy, and updates repository.rb and pkgdmg.rb to use it.
2013-02-22(#19409) Raise Puppet::Forge::Errors::ForgeError on bad HTTP response from forgeDominic Cleal1-0/+40
When a bad HTTP response indicating an error, or an "error" string in the response is received from the forge, raise Puppet::Forge::Errors::ForgeError subclases rather than RuntimeErrors. This allows the error to be caught by the module face and the error rendered appropriately, i.e. as JSON if requested by the user. Else fallback code for unhandled exceptions is used, causing the exception to only be written via logging.
2013-02-11(#18494) Fix Ruby version number format for Ruby 2.0.0-p-1Dominic Cleal1-1/+1
The additional hyphen between "p" and the patch number is now handled.
2013-02-06Fix encoding problem with test fileMathieu Mitchell1-0/+1
2013-02-06Fixed URI encoding problem with requirement stringMathieu Mitchell1-0/+9
When passing a requirement string with an unescaped URI character, such as '>= 1.0.3' to puppet module install, an error would be raised. Added URI escape to make_http_request to ensure all URIs are properly escaped.
2012-07-26(#15666) Include downstream error when raising CommunicationsError exceptionKen Barber2-1/+45
Previously we were seeing errors being returned in the acceptance framework, when the puppet module face had problems but the existing error message is far too generic to be used to understand the root cause of such problems. This patch changes the read_response code and CommunicationsError exceptions so that the underlying comms error message is exposed to the client. The generic message has been kept, but a new line 'Details:' has been added that will expose the underlying error. This patch solves this problem by accepting the original exception that was called, and using the message of that exception to describe the detail. To make sure the generic error will catch and wrap the correct exceptions, we have added a list of what we believe are the common exceptions that Net::HTTP raises when remote or network problems occur. Other exceptions will continue to be raised up to the face as per normal. Test coverage has been added to make sure the exceptions behave as expected, as this was lacking beforehand.
2012-07-23Reduce stubs and expectations on settingsPatrick Carlisle1-2/+2
Many tests set stubs or expectations on configuration values. This is unnecessary, as settings are reset before each test. Because creating a stub stubs out the entire value method on settings, stubbing any individual setting interferes with retrieving any other setting. This makes for weird errors and fragile tests. This commit changes most cases to just set each setting directly. Expectations on settings were often used to verify that a setting is used. This is not a good way of testing this, since it checks that the value is accessed but not that it is actually used correctly. Most expecations on settings are better expressed by changing the setting and then verifying a returned value.
2012-06-27(#14598) Add SSL support for forge interactionKen Barber1-3/+46
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-14Fix User-Agent for ruby 1.8.5Andrew Parker1-1/+1
The RUBY_PATCHLEVEL constant is not available on ruby 1.8.5. To fix this the pathlevel section will default to nothing if the RUBY_PATCHLEVEL is not available.
2012-05-11(#14387) Puppet's Module face should send a User-AgentAndrew Parker1-4/+43
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-05-11Cleanup of the Forge codeAndrew Parker1-42/+35
Removed some unreachable code that occured after an exception being thrown. Pushed the construction of the Net::HTTP::Get object into the repository so that it doesn't leak as much of its implementation out to its clients. Refactored the tests so that they include as many nested contexts and pulled out helper methods to make the tests be more explanatory.
2012-03-30Add Module ToolMatt Robinson1-30/+0
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.
2012-02-08(#12244) All forge interactions should be centralizedKelsey Hightower1-0/+86
Before this patch each module application makes direct connection to the Puppet Forge. This is a maintenance nightmare, any changes to the Forge API requires changes to all the module applications. This patch re-factors how we communicate with the Forge. All module application now use the interface exposed by the `lib/puppet/forge.rb` module. This patch also includes tests for the new forge.rb module, and updates others to reflect the new behaviour.