Merge pull request #704 from puppetlabs/release
authorEric Putnam <putnam.eric@gmail.com>
Mon, 25 Sep 2017 22:33:08 +0000 (15:33 -0700)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2017 22:33:08 +0000 (15:33 -0700)
(maint) Update release merge back

20 files changed:
.sync.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Gemfile
README.md
lib/facter/apt_updates.rb
lib/puppet/provider/apt_key/apt_key.rb
locales/config.yaml
manifests/init.pp
manifests/key.pp
manifests/params.pp
manifests/update.pp
metadata.json
spec/classes/apt_backports_spec.rb
spec/unit/facter/apt_has_updates_spec.rb
spec/unit/facter/apt_package_security_updates_spec.rb [new file with mode: 0644]
spec/unit/facter/apt_package_updates_spec.rb
spec/unit/facter/apt_security_updates_spec.rb
spec/unit/facter/apt_updates_spec.rb

index 1c79b46b328edb2445998e2d9d9b0d1f17ccb3ac..dd596277d31bc7a8364c03475e78bb6d52347b20 100644 (file)
--- a/.sync.yml
+++ b/.sync.yml
@@ -7,5 +7,8 @@ appveyor.yml:
   - set: docker/ubuntu-14.04
   - set: docker/debian-8
 
+NOTICE:
+  unmanaged: true
+
 spec/spec_helper.rb:
   allow_deprecations: true
index 115691d393be4b1af98560703842c6a9a2cc9937..9af2623346e9f99b2ec1de6c65724024f09610fc 100644 (file)
@@ -22,10 +22,10 @@ matrix:
     script: bundle exec rake beaker
     services: docker
     sudo: required
-  - rvm: 2.3.1
+  - rvm: 2.4.0
     bundler_args: --without system_tests
-    env: PUPPET_GEM_VERSION="~> 4.0"
-  - rvm: 2.1.7
+    env: PUPPET_GEM_VERSION="~> 5.0"
+  - rvm: 2.1.9
     bundler_args: --without system_tests
     env: PUPPET_GEM_VERSION="~> 4.0"
 notifications:
index e6e1344906b28e54c8beccaa69ff8055fc7fa92e..3473175318d22b94dc5e080ce9e9b1f49f05d303 100644 (file)
@@ -73,12 +73,12 @@ A release containing many bugfixes with additional features.
 - Replaced `-s` with `-f` in ppa rspec tests - After the repository is added, the "${::apt::sources_list_d}/${sources_list_d_filename}" file is created as an empty file. The unless condition of Exec["add-apt-repository-${name}"] calls test -s, which returns 1 if the file is empty. Because the file is empty, the unless condition is never true and the repository is added on every execution. This change replaces the -s test condition with -f, which is true if the file exists or false otherwise.
 - Limit non-strict parsing to pre-3.5.0 only - Puppet 3.5.0 introduced strict variables and the module handles strict variables by using the defined() function. This does not work on prior versions of puppet so we now gate based on that version. Puppet 4 series has a new setting `strict` that may be set to enforce strict variables while `strict_variables` remains unset (see PUP-6358) which causes the conditional in manifests/params.pp to erroniously use non-strict 3.5-era parsing and fail. This new conditional corrects the cases such that strict variable behavior happens on versions 3.5.0 and later.
 
-##Supported Release 2.2.2
-###Summary
+## Supported Release 2.2.2
+### Summary
 
 Several bug fixes and the addition of support updates to Debian 8 and Ubuntu Wily.
 
-####Bugfixes
+#### Bugfixes
 - Small fixes to descriptions within the readme and the addition of some examples.
 - Updates to run on Ubuntu Wily.
 - Fixed apt_key tempfile race condition.
@@ -92,92 +92,92 @@ Several bug fixes and the addition of support updates to Debian 8 and Ubuntu Wil
 - Look for correct sources.list.d file for apt::ppa.
 - Debian 8 support addiiton to metadata.
 
-##Supported Release 2.2.1
-###Summary
+## Supported Release 2.2.1
+### Summary
 
 Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
 
-##2015-09-29 - Supported Release 2.2.0
-###Summary
+## 2015-09-29 - Supported Release 2.2.0
+### Summary
 
 This release includes a few bugfixes.
 
-####Features
+#### Features
 - Adds an `ensure` parameter for user control of proxy presence.
 - Adds ability to set `notify_update` to `apt::conf` (MODULES-2269).
 - Apt pins no longer trigger an `apt-get update` run.
 - Adds support for creating pins from main class.
 
-####Bugfixes
+#### Bugfixes
 - Updates to use the official Debian mirrors.
 - Fixes path to `preferences` and `preferences.d`
 - Fixes pinning for backports (MODULES-2446).
 - Fixes the name/extension of the preferences files.
 
-##2015-07-28 - Supported Release 2.1.1
-###Summary
+## 2015-07-28 - Supported Release 2.1.1
+### Summary
 
 This release includes a few bugfixes.
 
-####Bugfixes
+#### Bugfixes
 - Fix incorrect use of anchoring (MODULES-2190)
 - Use correct comment type for apt.conf files
 - Test fixes
 - Documentation fixes
 
-##2015-06-16 - Supported Release 2.1.0
-###Summary
+## 2015-06-16 - Supported Release 2.1.0
+### Summary
 
 This release largely makes `apt::key` and `apt::source` API-compatible with the 1.8.x versions for ease in upgrading, and also addresses some compatibility issues with older versions of Puppet.
 
-####Features
+#### Features
 - Add API compatibility to `apt::key` and `apt::source`
 - Added `apt_reboot_required` fact
 
-####Bugfixes
+#### Bugfixes
 - Fix compatibility with Puppet versions 3.0-3.4
 - Work around future parser bug PUP-4133
 
-##2015-04-28 - Supported Release 2.0.1
-###Summary
+## 2015-04-28 - Supported Release 2.0.1
+### Summary
 
 This bug fixes a few compatibility issues that came up with the 2.0.0 release, and includes test and documentation updates.
 
-####Bugfixes
+#### Bugfixes
 - Fix incompatibility with keyrings containing multiple keys
 - Fix bugs preventing the module from working with Puppet < 3.5.0
 
-##2015-04-07 - Supported Release 2.0.0
-###Summary
+## 2015-04-07 - Supported Release 2.0.0
+### Summary
 
 This is a major rewrite of the apt module. Many classes and defines were removed, but all existing functionality should still work. Please carefully review documentation before upgrading.
 
-####Backwards-incompatible changes
+#### Backwards-incompatible changes
 
 As this is a major rewrite of the module there are a great number of backwards incompatible changes. Please review this and the updated README carefully before upgrading.
 
-#####`apt_key`
+##### `apt_key`
 - `keyserver_options` parameter renamed to `options`
 
-#####`apt::backports`
+##### `apt::backports`
 - This no longer works out of the box on Linux Mint. If using this on mint, you must specify the `location`, `release`, `repos`, and `key` parameters. [Example](examples/backports.pp)
 
-#####`apt::builddep`
+##### `apt::builddep`
 - This define was removed. Functionality can be matched passing 'build-dep' to `install_options` in the package resource. [Example](examples/builddep.pp)
 
-#####`apt::debian::testing`
+##### `apt::debian::testing`
 - This class was removed. Manually add an `apt::source` instead. [Example](examples/debian_testing.pp)
 
-#####`apt::debian::unstable`
+##### `apt::debian::unstable`
 - This class was removed. Manually add an `apt::source` instead. [Example](examples/debian_unstable.pp)
 
-#####`apt::force`
+##### `apt::force`
 - This define was removed. Functionallity can be matched by setting `install_options` in the package resource. See [here](examples/force.pp) for how to set the options.
 
-#####`apt::hold`
+##### `apt::hold`
 - This define was removed. Simply use an `apt::pin` with `priority => 1001` for the same functionality.
 
-#####`apt`
+##### `apt`
 - `always_apt_update` - This parameter was removed. Use `update => { 'frequency' => 'always' }` instead.
 - `apt_update_frequency` - This parameter was removed. Use `update => { 'frequency' => <frequency> }` instead.
 - `disable_keys` - This parameter was removed. See this [example](examples/disable_keys.pp) if you need this functionality.
@@ -190,17 +190,17 @@ As this is a major rewrite of the module there are a great number of backwards i
 - `update_timeout` - This parameter was removed. Use `update => { 'timeout' => <timeout> }` instead.
 - `update_tries` - This parameter was removed. Use `update => { 'tries' => <tries> }` instead.
 
-#####`apt::key`
+##### `apt::key`
 - `key` - This parameter was renamed to `id`.
 - `key_content` - This parameter was renamed to `content`.
 - `key_source` - This parameter was renamed to `source`.
 - `key_server` - This parameter was renamed to `server`.
 - `key_options` - This parameter was renamed to `options`.
 
-#####`apt::release`
+##### `apt::release`
 - This class was removed. See this [example](examples/release.pp) for how to achieve this functionality.
 
-#####`apt::source`
+##### `apt::source`
 - `include_src` - This parameter was removed. Use `include => { 'src' => <bool> }` instead. ***NOTE*** This now defaults to false.
 - `include_deb` - This parameter was removed. Use `include => { 'deb' => <bool> }` instead.
 - `required_packages` - This parameter was removed. Use package resources for these packages if needed.
@@ -210,35 +210,35 @@ As this is a major rewrite of the module there are a great number of backwards i
 - `key_source` - This parameter was removed. Use `key => { 'source' => <source> }` instead.
 - `trusted_source` - This parameter was renamed to `allow_unsigned`.
 
-#####`apt::unattended_upgrades`
+##### `apt::unattended_upgrades`
 - This class was removed and is being republished under the puppet-community namespace. The git repository is available [here](https://github.com/puppet-community/puppet-unattended_upgrades) and it will be published to the forge [here](https://forge.puppetlabs.com/puppet/unattended_upgrades).
 
-####Changes to default behavior
+#### Changes to default behavior
 - By default purge unmanaged files in 'sources.list', 'sources.list.d', 'preferences', and 'preferences.d'.
 - Changed default for `package_manage` in `apt::ppa` to `false`. Set to `true` in a single PPA if you need the package to be managed.
 - `apt::source` will no longer include the `src` entries by default. 
 - `pin` in `apt::source` now defaults to `undef` instead of `false`
 
-####Features
+#### Features
 - Added the ability to pass hashes of `apt::key`s, `apt::ppa`s, and `apt::setting`s to `apt`.
 - Added 'https' key to `proxy` hash to allow disabling `https_proxy` for the `apt::ppa` environment.
 - Added `apt::setting` define to abstract away configuration.
 - Added the ability to pass hashes to `pin` and `key` in `apt::backports` and `apt::source`.
 
-####Bugfixes
+#### Bugfixes
 - Fixes for strict variables.
 
-##2015-03-17 - Supported Release 1.8.0
-###Summary
+## 2015-03-17 - Supported Release 1.8.0
+### Summary
 
 This is the last planned feature release of the 1.x series of this module. All new features will be evaluated for puppetlabs-apt 2.x.
 
 This release includes many important features, including support for full fingerprints, and fixes issues where `apt_key` was not supporting user/password and `apt_has_updates` was not properly parsing the `apt-check` output.
 
-####Changes to default behavior
+#### Changes to default behavior
 - The apt module will now throw warnings if you don't use full fingerprints for `apt_key`s
 
-####Features
+#### Features
 - Use gpg to check keys to work around https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/1409117 (MODULES-1675)
 - Add 'oldstable' to the default update origins for wheezy
 - Add utopic, vivid, and cumulus compatibility
@@ -252,7 +252,7 @@ This release includes many important features, including support for full finger
   - `legacy_origin`
 - Separate `apt::pin` from `apt::backports` to allow pin by release instead of origin
 
-####Bugfixes
+#### Bugfixes
 - Cleanup lint and future parser issues
 - Fix to support username and passwords again for `apt_key` (MODULES-1119)
 - Fix issue where `apt::force` `$install_check` didn't work with non-English locales (MODULES-1231)
@@ -262,12 +262,12 @@ This release includes many important features, including support for full finger
 - Fix inconsistent headers across files (MODULES-1200)
 - Clean up formatting for 50unattended-upgrades.erb
 
-##2014-10-28 - Supported Release 1.7.0
-###Summary
+## 2014-10-28 - Supported Release 1.7.0
+### Summary
 
 This release includes several new features, documentation and test improvements, and a few bug fixes.
 
-####Features
+#### Features
 - Updated unit and acceptance tests
 - Update module to work with Linux Mint
 - Documentation updates
@@ -280,52 +280,52 @@ This release includes several new features, documentation and test improvements,
 - Added `apt_update_last_success` fact
 - Refactored facts for performance improvements
 
-####Bugfixes
+#### Bugfixes
 - Update apt::builddep to require Exec['apt_update'] instead of notifying it
 - Clean up lint errors
 
-##2014-08-20 - Supported Release 1.6.0
-###Summary
+## 2014-08-20 - Supported Release 1.6.0
+### Summary
 
-####Features
+#### Features
 - Allow URL or domain name for key_server parameter
 - Allow custom comment for sources list
 - Enable auto-update for Debian squeeze LTS
 - Add facts showing available updates
 - Test refactoring
 
-####Bugfixes
+#### Bugfixes
 - Allow dashes in URL or domain for key_server parameter
 
-##2014-08-13 - Supported Release 1.5.3
-###Summary
+## 2014-08-13 - Supported Release 1.5.3
+### Summary
 
 This is a bugfix releases.  It addresses a bad regex, failures with unicode
 characters, and issues with the $proxy_host handling in apt::ppa.
 
-####Features
+#### Features
 - Synced files from Modulesync
 
-####Bugfixes
+#### Bugfixes
 - Fix regex to follow APT requirements in apt::pin
 - Fix for unicode characters
 - Fix inconsistent $proxy_host handling in apt and apt::ppa
 - Fix typo in README
 - Fix broken acceptance tests
 
-##2014-07-15 - Supported Release 1.5.2
-###Summary
+## 2014-07-15 - Supported Release 1.5.2
+### Summary
 
 This release merely updates metadata.json so the module can be uninstalled and
 upgraded via the puppet module command.
 
-##2014-07-10 - Supported Release 1.5.1
-###Summary
+## 2014-07-10 - Supported Release 1.5.1
+### Summary
 
 This release has added tests to ensure graceful failure on OSX.
 
-##2014-06-04 - Release 1.5.0
-###Summary
+## 2014-06-04 - Release 1.5.0
+### Summary
 
 This release adds support for Ubuntu 14.04.  It also includes many new features 
 and important bugfixes.  One huge change is that apt::key was replaced with
@@ -334,7 +334,7 @@ your system.
 
 Special thanks to daenney, our intrepid unofficial apt maintainer!
 
-####Features
+#### Features
 - Add support for Ubuntu Trusty!
 - Add apt::hold define
 - Generate valid *.pref files in apt::pin
@@ -344,36 +344,36 @@ Special thanks to daenney, our intrepid unofficial apt maintainer!
 - apt::key rewritten to use apt_key type
 - Add support for update_tries to apt::update
 
-####Bugfixes
+#### Bugfixes
 - Typo fixes
 - Fix unattended upgrades
 - Removed bogus line when using purge_preferences
 - Fix apt::force to upgrade allow packages to be upgraded to the pacakge from the specified release
 
-##2014-03-04 - Supported Release 1.4.2
-###Summary
+## 2014-03-04 - Supported Release 1.4.2
+### Summary
 
 This is a supported release. This release tidies up 1.4.1 and re-enables
 support for Ubuntu 10.04
 
-####Features
+#### Features
 
-####Bugfixes
+#### Bugfixes
 - Fix apt:ppa to include the -y Ubuntu 10.04 requires.
 - Documentation changes.
 - Test fixups.
 
-####Known Bugs
+#### Known Bugs
 
 * No known issues.
 
 
 
-##2014-02-13 1.4.1
-###Summary
+## 2014-02-13 1.4.1
+### Summary
 This is a bugfix release.
 
-####Bugfixes
+#### Bugfixes
 - Fix apt::force unable to upgrade packages from releases other than its original
 - Removed a few refeneces to aptitude instead of apt-get for portability
 - Removed call to getparam() due to stdlib dependency
@@ -382,21 +382,21 @@ This is a bugfix release.
 - Use root to exec in apt::ppa
 - Updated tests and converted acceptance tests to beaker
 
-##2013-10-08 - Release 1.4.0
+## 2013-10-08 - Release 1.4.0
 
-###Summary
+### Summary
 
 Minor bugfix and allow the timeout to be adjusted.
 
-####Features
+#### Features
 - Add an `updates_timeout` to apt::params
 
-####Bugfixes
+#### Bugfixes
 - Ensure apt::ppa can read a ppa removed by hand.
 
 
-##2013-10-08 - Release 1.3.0
-###Summary
+## 2013-10-08 - Release 1.3.0
+### Summary
 
 This major feature in this release is the new apt::unattended_upgrades class,
 allowing you to handle Ubuntu's unattended feature.  This allows you to select
@@ -406,21 +406,21 @@ involvement.
 In addition we extend our Wheezy support, add proxy support to apt:ppa and do
 various cleanups and tweaks.
 
-####Features
+#### Features
 - Add apt::unattended_upgrades support for Ubuntu.
 - Add wheezy backports support.
 - Use the geoDNS http.debian.net instead of the main debian ftp server.
 - Add `options` parameter to apt::ppa in order to pass options to apt-add-repository command.
 - Add proxy support for apt::ppa (uses proxy_host and proxy_port from apt).
 
-####Bugfixes
+#### Bugfixes
 - Fix regsubst() calls to quote single letters (for future parser).
 - Fix lint warnings and other misc cleanup.
 
 
-##2013-07-03 - Release 1.2.0
+## 2013-07-03 - Release 1.2.0
 
-####Features
+#### Features
 - Add geppetto `.project` natures
 - Add GH auto-release
 - Add `apt::key::key_options` parameter
@@ -432,14 +432,14 @@ various cleanups and tweaks.
   - `apt::pin::label`
 - Add source architecture support to `apt::source::architecture`
 
-####Bugfixes
+#### Bugfixes
 - Use apt-get instead of aptitude in apt::force
 - Update default backports location
 - Add dependency for required packages before apt-get update
 
 
-##2013-06-02 - Release 1.1.1
-###Summary
+## 2013-06-02 - Release 1.1.1
+### Summary
 
 This is a bug fix release that resolves a number of issues:
 
@@ -473,14 +473,14 @@ Thanks to all the community contributors below that made this patch possible.
 
 
 ## Release 1.1.0
-###Summary
+### Summary
 
 This release includes Ubuntu 12.10 (Quantal) support for PPAs.
 
 ---
 
-##2012-05-25 - Puppet Labs <info@puppetlabs.com> - Release 0.0.4
-###Summary
+## 2012-05-25 - Puppet Labs <info@puppetlabs.com> - Release 0.0.4
+### Summary
 
  * Fix ppa list filename when there is a period in the PPA name
  * Add .pref extension to apt preferences files
@@ -488,8 +488,8 @@ This release includes Ubuntu 12.10 (Quantal) support for PPAs.
  * Extend pin support
 
 
-##2012-05-04 - Puppet Labs <info@puppetlabs.com> - Release 0.0.3
-###Summary
+## 2012-05-04 - Puppet Labs <info@puppetlabs.com> - Release 0.0.3
+### Summary
  
  * only invoke apt-get update once
  * only install python-software-properties if a ppa is added
@@ -502,8 +502,8 @@ This release includes Ubuntu 12.10 (Quantal) support for PPAs.
  * add support to pin release
 
 
-##2012-03-26 - Puppet Labs <info@puppetlabs.com> - Release 0.0.2
-###Summary
+## 2012-03-26 - Puppet Labs <info@puppetlabs.com> - Release 0.0.2
+### Summary
 
 * 41cedbb (#13261) Add real examples to smoke tests.
 * d159a78 (#13261) Add key.pp smoke test
@@ -517,8 +517,8 @@ This release includes Ubuntu 12.10 (Quantal) support for PPAs.
 * b9607a4 Convert apt::key to use anchors
 
 
-##2012-03-07 - Puppet Labs <info@puppetlabs.com> - Release 0.0.1
-###Summary
+## 2012-03-07 - Puppet Labs <info@puppetlabs.com> - Release 0.0.1
+### Summary
 
 * d4fec56 Modify apt::source release parameter test
 * 1132a07 (#12917) Add contributors to README
index 990edba7e70c856cb84c64affdafa9b4f98aa110..1a9fb3a5cd686bd5f281ea3c2eaec843d65b25cd 100644 (file)
@@ -1,63 +1,75 @@
-Checklist (and a short version for the impatient)
-=================================================
+# Contributing to Puppet modules
 
-  * Commits:
+So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing
+that very thing while setting expectations around code quality as well as a few tips for making the
+process as easy as possible. 
 
-    - Make commits of logical units.
+### Table of Contents
 
-    - Check for unnecessary whitespace with "git diff --check" before
-      committing.
+1. [Getting Started](#getting-started)
+1. [Commit Checklist](#commit-checklist)
+1. [Submission](#submission)
+1. [More about commits](#more-about-commits)
+1. [Testing](#testing)
+    - [Running Tests](#running-tests)
+    - [Writing Tests](#writing-tests)
+1. [Get Help](#get-help)
 
-    - Commit using Unix line endings (check the settings around "crlf" in
-      git-config(1)).
+## Getting Started
 
-    - Do not check in commented out code or unneeded files.
+- Fork the module repository on GitHub and clone to your workspace
 
-    - The first line of the commit message should be a short
-      description (50 characters is the soft limit, excluding ticket
-      number(s)), and should skip the full stop.
+- Make your changes!
 
-    - Associate the issue in the message. The first line should include
-      the issue number in the form "(#XXXX) Rest of message".
+## Commit Checklist
 
-    - The body should provide a meaningful commit message, which:
+### The Basics
 
-      - uses the imperative, present tense: "change", not "changed" or
-        "changes".
+- [x] my commit is a single logical unit of work
 
-      - includes motivation for the change, and contrasts its
-        implementation with the previous behavior.
+- [x] I have checked for unnecessary whitespace with "git diff --check" 
 
-    - Make sure that you have tests for the bug you are fixing, or
-      feature you are adding.
+- [x] my commit does not include commented out code or unneeded files
 
-    - Make sure the test suites passes after your commit:
-      `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
+### The Content
 
-    - When introducing a new feature, make sure it is properly
-      documented in the README.md
+- [x] my commit includes tests for the bug I fixed or feature I added
 
-  * Submission:
+- [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
+    
+- [x] my code passes existing test suites
 
-    * Pre-requisites:
+### The Commit Message
 
-      - Make sure you have a [GitHub account](https://github.com/join)
+- [x] the first line of my commit message includes:
 
-      - [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
+  - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line" 
+  
+  - [x] a short description (50 characters is the soft limit, excluding ticket number(s))
 
-    * Preferred method:
+- [x] the body of my commit message:
 
-      - Fork the repository on GitHub.
+  - [x] is meaningful
 
-      - Push your changes to a topic branch in your fork of the
-        repository. (the format ticket/1234-short_description_of_change is
-        usually preferred for this project).
+  - [x] uses the imperative, present tense: "change", not "changed" or "changes"
 
-      - Submit a pull request to the repository in the puppetlabs
-        organization.
+  - [x] includes motivation for the change, and contrasts its implementation with the previous behavior
 
-The long version
-================
+## Submission
+
+### Pre-requisites
+
+- Make sure you have a [GitHub account](https://github.com/join)
+
+- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
+
+### Push and PR
+
+- Push your changes to your fork
+
+- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
+
+## More about commits 
 
   1.  Make separate commits for logically separate changes.
 
@@ -104,37 +116,32 @@ The long version
       GitHub has some pretty good
       [general documentation](http://help.github.com/) on using
       their site.  They also have documentation on
-      [creating pull requests](http://help.github.com/send-pull-requests/).
+      [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
 
       In general, after pushing your topic branch up to your
       repository on GitHub, you can switch to the branch in the
       GitHub UI and click "Pull Request" towards the top of the page
       in order to open a pull request.
 
+  3.  Update the related JIRA issue.
 
-  3.  Update the related GitHub issue.
-
-      If there is a GitHub issue associated with the change you
+      If there is a JIRA issue associated with the change you
       submitted, then you should update the ticket to include the
       location of your branch, along with any other commentary you
       may wish to make.
 
-Testing
-=======
+# Testing
 
-Getting Started
----------------
+## Getting Started
 
-Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
-package manager such as [bundler](http://bundler.io/) what Ruby packages,
+Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
 or Gems, are required to build, develop, and test this software.
 
-Please make sure you have [bundler installed](http://bundler.io/#getting-started)
-on your system, then use it to install all dependencies needed for this project,
-by running
+Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to 
+install all dependencies needed for this project in the project root by running
 
 ```shell
-% bundle install
+% bundle install --path .bundle/gems
 Fetching gem metadata from https://rubygems.org/........
 Fetching gem metadata from https://rubygems.org/..
 Using rake (10.1.0)
@@ -148,7 +155,7 @@ Your bundle is complete!
 Use `bundle show [gemname]` to see where a bundled gem is installed.
 ```
 
-NOTE some systems may require you to run this command with sudo.
+NOTE: some systems may require you to run this command with sudo.
 
 If you already have those gems installed, make sure they are up-to-date:
 
@@ -156,26 +163,27 @@ If you already have those gems installed, make sure they are up-to-date:
 % bundle update
 ```
 
-With all dependencies in place and up-to-date we can now run the tests:
+## Running Tests
+
+With all dependencies in place and up-to-date, run the tests:
+
+### Unit Tests
 
 ```shell
 % bundle exec rake spec
 ```
 
-This will execute all the [rspec tests](http://rspec-puppet.com/) tests
-under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
-and so on. rspec tests may have the same kind of dependencies as the
-module they are testing. While the module defines in its [Modulefile](./Modulefile),
+This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on. 
+rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json),
 rspec tests define them in [.fixtures.yml](./fixtures.yml).
 
-Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
-tests. These tests spin up a virtual machine under
-[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
-[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
-scenarios. In order to run these, you will need both of those tools
-installed on your system.
+### Acceptance Tests
+
+Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under
+[VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test
+scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system.
 
-You can run them by issuing the following command
+Run the tests by issuing the following command
 
 ```shell
 % bundle exec rake spec_clean
@@ -183,35 +191,81 @@ You can run them by issuing the following command
 ```
 
 This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
-install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
+install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
 and then run all the tests under [spec/acceptance](./spec/acceptance).
 
-Writing Tests
--------------
+## Writing Tests
+
+### Unit Tests
 
-XXX getting started writing tests.
+When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a 
+catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs] 
+but here's a tiny sample:
 
-If you have commit access to the repository
-===========================================
+Sample manifest:
 
-Even if you have commit access to the repository, you will still need to
-go through the process above, and have someone else review and merge
-in your changes.  The rule is that all changes must be reviewed by a
-developer on the project (that did not write the code) to ensure that
-all changes go through a code review process.
+```puppet
+file { "a test file":
+  ensure => present,
+  path   => "/etc/sample",
+}
+```
+
+Sample test:
 
-Having someone other than the author of the topic branch recorded as
-performing the merge is the record that they performed the code
-review.
+```ruby
+it 'does a thing' do
+  expect(subject).to contain_file("a test file").with({:path => "/etc/sample"})
+end
+```
 
+### Acceptance Tests
+
+Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it
+twice to check for idempotency or errors, then run expectations.
+
+```ruby
+it 'does an end-to-end thing' do
+  pp = <<-EOF
+    file { 'a test file': 
+      ensure  => present,
+      path    => "/etc/sample",
+      content => "test string",
+    }
+    
+  apply_manifest(pp, :catch_failures => true)
+  apply_manifest(pp, :catch_changes => true)
+  
+end
+
+describe file("/etc/sample") do
+  it { is_expected.to contain "test string" }
+end
 
-Additional Resources
-====================
+```
 
-* [Getting additional help](http://puppet.com/community/get-help)
+# If you have commit access to the repository
 
-* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
+Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
+in your changes.  The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that
+all changes go through a code review process.**
 
-* [General GitHub documentation](http://help.github.com/)
+The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch.
 
+# Get Help
+
+### On the web
+* [Puppet help messageboard](http://puppet.com/community/get-help)
+* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
+* [General GitHub documentation](http://help.github.com/)
 * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
+
+### On chat
+* Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
+* IRC (freenode) #puppet-dev, #voxpupuli
+
+
+[rspec-puppet]: http://rspec-puppet.com/
+[rspec-puppet_docs]: http://rspec-puppet.com/documentation/
+[beaker]: https://github.com/puppetlabs/beaker
+[beaker-rspec]: https://github.com/puppetlabs/beaker-rspec
diff --git a/Gemfile b/Gemfile
index 46cb2eacec6c449052b3e1f7aad6aa8e1bbd5956..a9f0161c79e6ba92b7a4f6f7a52750339be2299e 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -33,13 +33,13 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
 minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
 
 group :development do
-  gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
-  gem "puppet-module-win-default-r#{minor_version}",   :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
-  gem "puppet-module-posix-dev-r#{minor_version}",     :require => false, :platforms => "ruby"
-  gem "puppet-module-win-dev-r#{minor_version}",       :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
-  gem "json_pure", '<= 2.0.1',                         :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
-  gem "fast_gettext", '1.1.0',                         :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
-  gem "fast_gettext",                                  :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
+  gem "puppet-module-posix-default-r#{minor_version}",    :require => false, :platforms => "ruby"
+  gem "puppet-module-win-default-r#{minor_version}",      :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
+  gem "puppet-module-posix-dev-r#{minor_version}",        :require => false, :platforms => "ruby"
+  gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
+  gem "json_pure", '<= 2.0.1',                            :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
+  gem "fast_gettext", '1.1.0',                            :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
+  gem "fast_gettext",                                     :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
 end
 
 group :system_tests do
@@ -50,6 +50,7 @@ group :system_tests do
   gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])                
   gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
   gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')        
+  gem "puppet-blacksmith", '~> 3.4',                                             :require => false
 end
 
 gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
index 3168f518cb212451ed2db81e11d629adf68b04b9..9c2ded4b12abc33c40ae8ce23378e85f7512e525 100644 (file)
--- a/README.md
+++ b/README.md
@@ -91,6 +91,15 @@ class { 'apt':
   },
 }
 ```
+When `Exec['apt_update']` is triggered, it will generate a `Notice` message. Because the default [logging level for agents](https://docs.puppet.com/puppet/latest/configuration.html#loglevel) is `notice`, this will cause the repository update to appear in logs and agent reports. Some tools, such as [The Foreman](https://www.theforeman.org), report the update notice as a significant change. By setting the [loglevel](https://docs.puppet.com/puppet/latest/metaparameter.html#loglevel) metaparameter for `Exec['apt_update']` above the agent logging level, one can eliminate these updates from reports:
+```puppet
+class { 'apt':
+  update => {
+    frequency => 'daily',
+    loglevel  => 'debug',
+  },
+}
+```
 
 ### Pin a specific release
 
@@ -270,7 +279,7 @@ Main class, includes all other classes.
 
   * 'host': Specifies a proxy host to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: a string containing a hostname. Default: undef.
 
-  * 'port': Specifies a proxy port to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: a string containing a port number. Default: '8080'.
+  * 'port': Specifies a proxy port to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: an integer containing a port number. Default: 8080.
 
   * 'https': Specifies whether to enable https proxies. Valid options: 'true' and 'false'. Default: 'false'.
 
@@ -313,8 +322,7 @@ Manages backports.
 
 * `location`: Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Defaults:
 
-  * Debian (squeeze): 'http://httpredir.debian.org/debian-backports'
-  * Debian (other): 'http://httpredir.debian.org/debian'
+  * Debian: 'http://deb.debian.org/debian'
   * Ubuntu: 'http://archive.ubuntu.com/ubuntu'
 
 * `pin`: *Optional.* Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. Default: '200'.
@@ -360,16 +368,6 @@ The `apt::key` defined type makes use of the `apt_key` type, but includes extra
 
 * `server`: Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or hkp://). Default: 'keyserver.ubuntu.com'.
 
-* `key`: Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal characters, optionally prefixed with "0x") or a full key fingerprint (40 hexadecimal characters). Default: undef. **Note** This parameter is deprecated and will be removed in a future release.
-
-* `key_content`: Supplies the entire GPG key. Useful in case the key can't be fetched from a remote location and using a file resource is inconvenient. Valid options: a string. Default: undef. **Note** This parameter is deprecated and will be removed in a future release.
-
-* `key_source`: Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or an absolute path. Default: undef. **Note** This parameter is deprecated and will be removed in a future release.
-
-* `key_server`: Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or hkp://). Default: 'keyserver.ubuntu.com'. **Note** This parameter is deprecated and will be removed in a future release.
-
-* `key_options`: Passes additional options to `apt-key adv --keyserver-options`. Valid options: a string. Default: undef. **Note** This parameter is deprecated and will be removed in a future release.
-
 #### Defined Type: `apt::pin`
 
 Manages Apt pins. Does not trigger an `apt-get update` run.
@@ -473,20 +471,6 @@ Manages the Apt sources in `/etc/apt/sources.list.d/`.
 
   * `repos`: Specifies a component of the Apt repository. Valid options: a string. Default: 'main'.
 
-* `include_deb`: Specify whether to request the distrubution's compiled binaries. Valid options: 'true' and 'false'. Default: undef. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `include_src`: Specifies whether to request the distribution's uncompiled source code. Valid options: 'true' and 'false'. Default: undef. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `required_packages`: Installs packages required for this Apt source via an exec. Default: 'false'. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `key_content`: Specifies the content to be passed to `apt::key`. Default: undef. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `key_server`: Specifies the server to be passed to `apt::key`. Default: undef. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `key_source`: Specifies the source to be passed to `apt::key`. Default: undef. **Note**: This parameter is deprecated and will be removed in future versions of the module.
-
-* `trusted_source`: Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked. Valid options: 'true' and 'false'. Default: undef. This parameter is **deprecated** and will be removed in a future version of the module.
-
 * `notify_update`: *Optional.* Specifies whether to trigger an `apt-get update` run. Valid options: 'true' and 'false'. Default: 'true'.
 
 #### Type: `apt_key`
index e880fdf29841b264b01335b709caf30f78693d15..e101dd79a477aae25ebf99995f080f15a76d95a3 100644 (file)
@@ -2,7 +2,7 @@ apt_package_updates = nil
 Facter.add("apt_has_updates") do
   confine :osfamily => 'Debian'
   if File.executable?("/usr/bin/apt-get")
-    apt_get_result = Facter::Util::Resolution.exec('/usr/bin/apt-get -s upgrade 2>&1')
+    apt_get_result = Facter::Util::Resolution.exec('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1')
     if not apt_get_result.nil?
       apt_package_updates = [[], []]
       apt_get_result.each_line do |line|
@@ -42,6 +42,17 @@ Facter.add("apt_package_updates") do
   end
 end
 
+Facter.add("apt_package_security_updates") do
+  confine :apt_has_updates => true
+  setcode do
+    if Facter.version < '2.0.0'
+      apt_package_updates[1].join(',')
+    else
+      apt_package_updates[1]
+    end
+  end
+end
+
 Facter.add("apt_updates") do
   confine :apt_has_updates => true
   setcode do
index 668fd0f18d2ee35c0addb98e1bd365956d7f2a11..3f95c3cc96af9c68f40234d6f07a9a3072be5173 100644 (file)
@@ -26,15 +26,25 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
       key_output = apt_key(cli_args)
     end
 
-    pub_line, fpr_line = nil
+    pub_line, sub_line, fpr_line = nil
 
     key_array = key_output.split("\n").collect do |line|
       if line.start_with?('pub')
           pub_line = line
+          # reset fpr_line, to skip any previous subkeys which were collected
+          fpr_line = nil
+          sub_line = nil
+      elsif line.start_with?('sub')
+          sub_line = line
       elsif line.start_with?('fpr')
           fpr_line = line
       end
 
+      if (sub_line and fpr_line)
+        sub_line, fpr_line = nil
+        next
+      end
+
       next unless (pub_line and fpr_line)
 
       line_hash = key_line_hash(pub_line, fpr_line)
index 07c0b9bb919a49a3bd8d5d9fbad646df037f9fce..3f6426321892c1e026211e9d12e0e08528a1edd7 100644 (file)
@@ -22,4 +22,5 @@ gettext:
   # Patterns for +Dir.glob+ used to find all files that might contain
   # translatable content, relative to the project root directory
   source_files:
+      - './lib/**/*.rb'
   
index c89c2230cfd684c108acb924ca74868f345e8222..44e66ce51ff2dd00980603ae05423c11d092cae3 100644 (file)
@@ -178,4 +178,19 @@ class apt (
   if $pins {
     create_resources('apt::pin', $pins)
   }
+
+  # required for adding GPG keys on Debian 9 (and derivatives)
+  case $facts['os']['name'] {
+    'Debian': {
+      if versioncmp($facts['os']['release']['full'], '9.0') >= 0 {
+        ensure_packages(['dirmngr'])
+      }
+    }
+    'Ubuntu': {
+      if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
+        ensure_packages(['dirmngr'])
+      }
+    }
+    default: { }
+  }
 }
index dfa1daf2b61935886b79cf22b5876511807397c4..8f9d66bcc9a1bf2b45742fec5007a9a849a98f31 100644 (file)
@@ -33,6 +33,24 @@ define apt::key (
           server  => $server,
           options => $options,
         } -> anchor { "apt_key ${id} present": }
+
+        case $facts['os']['name'] {
+          'Debian': {
+            if versioncmp($facts['os']['release']['full'], '9.0') >= 0 {
+              Apt::Key<| title == $title |> {
+                require => Package['dirmngr']
+              }
+            }
+          }
+          'Ubuntu': {
+            if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
+              Apt::Key<| title == $title |> {
+                require => Package['dirmngr']
+              }
+            }
+          }
+          default: { }
+        }
       }
     }
 
index 8fd658b90d6761c02b423662271523cc97afa27e..8126c02be5ccb487776ce3d28071bcf2afa9d563 100644 (file)
@@ -39,6 +39,7 @@ class apt::params {
 
   $update_defaults = {
     'frequency' => 'reluctantly',
+    'loglevel'  => undef,
     'timeout'   => undef,
     'tries'     => undef,
   }
@@ -72,16 +73,9 @@ class apt::params {
   case $facts['os']['name']{
     'Debian': {
       case $facts['os']['release']['full'] {
-        '6.0': {
-          $backports = {
-            'location' => 'http://httpredir.debian.org/debian-backports',
-            'key'      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
-            'repos'    => 'main contrib non-free',
-          }
-        }
         default: {
           $backports = {
-            'location' => 'http://httpredir.debian.org/debian',
+            'location' => 'http://deb.debian.org/debian',
             'key'      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
             'repos'    => 'main contrib non-free',
           }
@@ -108,7 +102,7 @@ class apt::params {
           $ppa_options        = '-y'
           $ppa_package        = 'python-software-properties'
         }
-        '14.04', '14.10', '15.04', '15.10': {
+        '14.04', '14.10', '15.04', '15.10', '16.04': {
           $ppa_options        = '-y'
           $ppa_package        = 'software-properties-common'
         }
@@ -119,7 +113,7 @@ class apt::params {
       }
     }
     undef: {
-      fail('Unable to determine full release number')
+      fail('Unable to determine value for fact os["name"]')
     }
     default: {
       $ppa_options = undef
index 4a8a7c8c21be204eb104da03139fbfdf2d89a45e..461e8c14e1768927b838d0a715766d08809f8e37 100644 (file)
@@ -52,6 +52,7 @@ class apt::update {
   }
   exec { 'apt_update':
     command     => "${::apt::provider} update",
+    loglevel    => $::apt::_update['loglevel'],
     logoutput   => 'on_failure',
     refreshonly => $_refresh,
     timeout     => $::apt::_update['timeout'],
index 03981dfbd34adf59a611693058d93453659a5110..4e65705322cf6e65663e3224b75eecbc388f1052 100644 (file)
     {
       "operatingsystem": "Debian",
       "operatingsystemrelease": [
-        "6",
         "7",
-        "8"
+        "8",
+        "9"
       ]
     },
     {
       "operatingsystem": "Ubuntu",
       "operatingsystemrelease": [
-        "10.04",
-        "12.04",
         "14.04",
         "16.04"
       ]
@@ -33,7 +31,7 @@
   "requirements": [
     {
       "name": "puppet",
-      "version_requirement": ">= 4.7.0 < 5.0.0"
+      "version_requirement": ">= 4.7.0 < 6.0.0"
     }
   ]
 }
index 1dfbf3759d61868aa53c75e10f24950b9d6d63d6..f2172d92a99396031c349062a70725e4eed2cbea 100644 (file)
@@ -15,7 +15,7 @@ describe 'apt::backports', :type => :class do
         }
       end
       it { is_expected.to contain_apt__source('backports').with({
-        :location => 'http://httpredir.debian.org/debian',
+        :location => 'http://deb.debian.org/debian',
         :key      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
         :repos    => 'main contrib non-free',
         :release  => 'wheezy-backports',
@@ -23,25 +23,6 @@ describe 'apt::backports', :type => :class do
       })
       }
     end
-    context 'defaults on squeeze' do
-      let(:facts) do
-        {
-          :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '6', :full => '6.0' }},
-          :lsbdistid       => 'Debian',
-          :osfamily        => 'Debian',
-          :lsbdistcodename => 'squeeze',
-          :puppetversion   => Puppet.version,
-        }
-      end
-      it { is_expected.to contain_apt__source('backports').with({
-        :location => 'http://httpredir.debian.org/debian-backports',
-        :key      => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
-        :repos    => 'main contrib non-free',
-        :release  => 'squeeze-backports',
-        :pin      => { 'priority' => 200, 'release' => 'squeeze-backports' },
-      })
-      }
-    end
     context 'defaults on ubuntu' do
       let(:facts) do
         {
index bcd6bb55477eb3a75daf5d4fa0a49bb19187deb2..d030e0f536145fa199b012deb2d77428eb560860 100644 (file)
@@ -26,7 +26,7 @@ describe 'apt_has_updates fact' do
       File.stubs(:executable?) # Stub all other calls
       Facter::Util::Resolution.stubs(:exec) # Catch all other calls
       File.expects(:executable?).with('/usr/bin/apt-get').returns true
-      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s upgrade 2>&1').returns ""+
+      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1').returns ""+
         "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"+
diff --git a/spec/unit/facter/apt_package_security_updates_spec.rb b/spec/unit/facter/apt_package_security_updates_spec.rb
new file mode 100644 (file)
index 0000000..868375e
--- /dev/null
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+describe 'apt_package_security_updates fact' do
+  subject { Facter.fact(:apt_package_security_updates).value }
+  after(:each) { Facter.clear }
+
+  describe 'when apt has no updates' do
+    before { 
+      Facter.fact(:apt_has_updates).stubs(:value).returns false
+    }
+    it { is_expected.to be nil }
+  end
+
+  describe 'when apt has updates' do
+    before { 
+      Facter.fact(:osfamily).stubs(:value).returns 'Debian'
+      File.stubs(:executable?) # Stub all other calls
+      Facter::Util::Resolution.stubs(:exec) # Catch all other calls
+      File.expects(:executable?).with('/usr/bin/apt-get').returns true
+      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1').returns ""+
+        "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
+        "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
+        "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"+
+        "Conf unhide.rb (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"
+    }
+    it {
+      if Facter.version < '2.0.0'
+        is_expected.to eq('tzdata')
+      else
+        is_expected.to eq(['tzdata'])
+      end
+    }
+  end
+end
index d7587ca99632312cfa4760e26f8e4ee213057809..49ceceeb93bd477e83584cbcc8f71002956cdadf 100644 (file)
@@ -17,7 +17,7 @@ describe 'apt_package_updates fact' do
       File.stubs(:executable?) # Stub all other calls
       Facter::Util::Resolution.stubs(:exec) # Catch all other calls
       File.expects(:executable?).with('/usr/bin/apt-get').returns true
-      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s upgrade 2>&1').returns ""+
+      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1').returns ""+
         "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"+
index 174b60d6b6497cf87e1379740c05be32cd2d41cd..f0dcab2cde3e178d4efc048d7877ce17a243f4bd 100644 (file)
@@ -17,7 +17,7 @@ describe 'apt_security_updates fact' do
       File.stubs(:executable?) # Stub all other calls
       Facter::Util::Resolution.stubs(:exec) # Catch all other calls
       File.expects(:executable?).with('/usr/bin/apt-get').returns true
-      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s upgrade 2>&1').returns ""+
+      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1').returns ""+
         "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"+
index 8c726fc343539f101daab2cc64fe80f3588a9b61..d2c2bf24bdd5860c07292934c7fe7081a8f2ae14 100644 (file)
@@ -17,7 +17,7 @@ describe 'apt_updates fact' do
       File.stubs(:executable?) # Stub all other calls
       Facter::Util::Resolution.stubs(:exec) # Catch all other calls
       File.expects(:executable?).with('/usr/bin/apt-get').returns true
-      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s upgrade 2>&1').returns ""+
+      Facter::Util::Resolution.expects(:exec).with('/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade 2>&1').returns ""+
         "Inst tzdata [2015f-0+deb8u1] (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Conf tzdata (2015g-0+deb8u1 Debian:stable-updates [all])\n"+
         "Inst unhide.rb [13-1.1] (22-2~bpo8+1 Debian Backports:jessie-backports [all])\n"+