Showing with 346 additions and 148 deletions.
  1. +6 −0 .fixtures.yml
  2. +1 −1 .gitignore
  3. +3 −1 .pdkignore
  4. +1 −0 .puppet-lint.rc
  5. +6 −2 .rubocop.yml
  6. +4 −34 .sync.yml
  7. +79 −13 .travis.yml
  8. +6 −0 .vscode/extensions.json
  9. +15 −0 CHANGELOG.md
  10. +12 −16 Gemfile
  11. +29 −15 README.md
  12. +25 −0 REFERENCE.md
  13. +2 −7 Rakefile
  14. +1 −0 appveyor.yml
  15. +25 −0 distelli-manifest.yml
  16. +10 −8 metadata.json
  17. +16 −0 provision.yaml
  18. +22 −25 spec/acceptance/init_spec.rb
  19. +7 −0 spec/spec_helper.rb
  20. +76 −26 spec/spec_helper_acceptance.rb
6 changes: 6 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

fixtures:
repositories:
"facts": "git://github.com/puppetlabs/puppetlabs-facts.git"
"puppet_agent": "git://github.com/puppetlabs/puppetlabs-puppet_agent.git"
"provision": "git://github.com/puppetlabs/provision.git"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
/convert_report.txt
/update_report.txt
.DS_Store
.vscode/
.envrc
/inventory.yaml
4 changes: 3 additions & 1 deletion .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/convert_report.txt
/update_report.txt
.DS_Store
.vscode/
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
Expand All @@ -32,8 +32,10 @@
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
8 changes: 6 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Expand All @@ -19,10 +21,12 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
- spec/**/*
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand Down
38 changes: 4 additions & 34 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@
unmanaged: true

.travis.yml:
docker_sets:
- set: docker/centos-7
- set: docker/ubuntu-14.04
docker_defaults:
bundler_args: ""
secure: ""
branches:
- release
global_env:
- GEM_BOLT=true
remove_includes:
- env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4
unmanaged: true

appveyor.yml:
unmanaged: true

Gemfile:
optional:
Expand All @@ -28,27 +19,6 @@ Gemfile:
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
required:
':system_tests':
- gem: 'puppet-module-posix-system-r#{minor_version}'
platforms: ruby
- gem: 'puppet-module-win-system-r#{minor_version}'
platforms:
- mswin
- mingw
- x64_mingw
- gem: bolt
version: '~> 1.3'
condition: ENV['GEM_BOLT']

Rakefile:
requires:
- puppet-lint/tasks/puppet-lint
extras: |
# spec_prep is required to setup fixtures used by the acceptance tests
beaker_task = Rake::Task['beaker']
spec_prep = Rake::Task['spec_prep']
beaker_task.enhance(beaker_task.prerequisite_tasks << spec_prep)

spec/spec_helper.rb:
mock_with: ':rspec'
Expand Down
92 changes: 79 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
dist: trusty
dist: xenial
language: ruby
cache: bundler
before_install:
Expand All @@ -12,34 +12,100 @@ script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.1
- 2.5.3
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- GEM_BOLT=true
- PUPPET_GEM_VERSION="~> 6.0"
matrix:
fast_finish: true
include:
-
bundler_args:
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
rvm: 2.5.1
script: bundle exec rake beaker
env: PLATFORMS=debian_puppet5
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_deb]'
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
- bundle exec rake 'litmus:install_agent[puppet5]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
bundler_args:
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
rvm: 2.5.1
script: bundle exec rake beaker
env: PLATFORMS=debian_puppet6
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_deb]'
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
- bundle exec rake 'litmus:install_agent[puppet6]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
bundler_args:
dist: trusty
env: PLATFORMS=el6_puppet5
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_el6]'
- bundle exec rake 'litmus:install_agent[puppet5]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
bundler_args:
dist: trusty
env: PLATFORMS=el6_puppet6
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_el6]'
- bundle exec rake 'litmus:install_agent[puppet6]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
bundler_args:
dist: trusty
env: PLATFORMS=el7_puppet5
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_el7]'
- bundle exec rake 'litmus:install_agent[puppet5]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
bundler_args:
dist: trusty
env: PLATFORMS=el7_puppet6
rvm: 2.5.3
before_script:
- bundle exec rake 'litmus:provision_list[travis_el7]'
- bundle exec rake 'litmus:install_agent[puppet6]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:parallel
services: docker
sudo: required
-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK=parallel_spec
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.5
branches:
only:
- master
Expand All @@ -55,4 +121,4 @@ deploy:
on:
tags: true
all_branches: true
condition: "$DEPLOY_TO_FORGE = yes"
condition: "$DEPLOY_TO_FORGE = yes"
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"rebornix.Ruby"
]
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v0.5.0](https://github.com/puppetlabs/puppetlabs-facter_task/tree/v0.5.0) (2019-09-05)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-facter_task/compare/0.4.1...v0.5.0)

### Changed

- pdksync - \(MODULES-8444\) - Raise lower Puppet bound [\#69](https://github.com/puppetlabs/puppetlabs-facter_task/pull/69) ([david22swan](https://github.com/david22swan))

### Added

- FM-8218 Port Module facter\_task to Litmus [\#79](https://github.com/puppetlabs/puppetlabs-facter_task/pull/79) ([sheenaajay](https://github.com/sheenaajay))
- \(FM-8153\) Add Windows Server 2019 support [\#73](https://github.com/puppetlabs/puppetlabs-facter_task/pull/73) ([eimlav](https://github.com/eimlav))
- \(FM-8040\) Add RedHat 8 support [\#72](https://github.com/puppetlabs/puppetlabs-facter_task/pull/72) ([eimlav](https://github.com/eimlav))
- FM-7944 - stringify facter\_task [\#71](https://github.com/puppetlabs/puppetlabs-facter_task/pull/71) ([lionce](https://github.com/lionce))

## [0.4.1](https://github.com/puppetlabs/puppetlabs-facter_task/tree/0.4.1) (2019-04-05)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-facter_task/compare/0.4.0...0.4.1)
Expand Down
28 changes: 12 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
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 "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-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-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "bolt", '~> 1.3', require: false if ENV['GEM_BOLT']
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 "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@

#### Table of Contents

1. [Description](#description)
2. [Requirements](#requirements)
3. [Usage - Configuration options and additional functionality](#usage)
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Getting help - Some Helpful commands](#getting-help)
- [facter_task](#factertask)
- [Table of Contents](#Table-of-Contents)
- [Overview](#Overview)
- [Module Description](#Module-Description)
- [Setup](#Setup)
- [Requirements](#Requirements)
- [Usage](#Usage)
- [Reference](#Reference)
- [Limitations](#Limitations)
- [Development](#Development)

## Description
## Overview

This module provides the facter_task task. This task allows you to discover facts about remote machines in your infrastructure.
This module provides the facter_task task.

## Requirements
## Module Description

This task allows you to discover facts about remote machines in your infrastructure.

## Setup

### Requirements
This module is compatible with Puppet Enterprise and Puppet Bolt.

* To run tasks with Puppet Enterprise, PE 2018.1 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must be Puppet agents.
Expand All @@ -23,6 +33,10 @@ This module is compatible with Puppet Enterprise and Puppet Bolt.

## Usage

To view the available actions and parameters, on the command line, run `puppet task show facter_task` or see the facter_task module page on the [Forge](https://forge.puppet.com/puppetlabs/facter_task/tasks).
For a complete list of facts that are supported, see the Puppet [core facts](https://docs.puppet.com/facter/latest/core_facts.html) documentation.
To show help for the task CLI, run `puppet task run --help` or `bolt task run --help`

To run a facter_task task, use the task command, specifying the fact you want to retrieve.

* With PE on the command line, run `puppet task run facter_task fact=<FACT>`.
Expand All @@ -37,19 +51,19 @@ You can also run tasks in the PE console. See PE task documentation for complete

## Reference

To view the available actions and parameters, on the command line, run `puppet task show facter_task` or see the facter_task module page on the [Forge](https://forge.puppet.com/puppetlabs/facter_task/tasks).

For a complete list of facts that are supported, see the Puppet [core facts](https://docs.puppet.com/facter/latest/core_facts.html) documentation.
For information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-facter_task/blob/master/REFERENCE.md).

## Limitations

To run acceptance tests against Windows machines locally, ensure that the `BEAKER_password` environment variable has been set to the password of the Administrator user of the target machine.

For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-facter_task/blob/master/metadata.json)

## Getting Help
## Development

We are experimenting with a new tool for running acceptance tests. Its name is [puppet_litmus](https://github.com/puppetlabs/puppet_litmus) this replaces beaker as the test runner. To run the acceptance tests follow the instructions from this point [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module).

Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. To contribute to Puppet projects, see our [module contribution guide.](https://github.com/puppetlabs/puppetlabs-facter_task/blob/master/CONTRIBUTING.md)

To display help for the facter_task task, run `puppet task show facter_task`

To show help for the task CLI, run `puppet task run --help` or `bolt task run --help`

Loading