Showing with 187 additions and 61 deletions.
  1. +1 −1 .gitattributes
  2. +2 −0 .gitignore
  3. +15 −0 .pdkignore
  4. 0 .puppet-lint.rc
  5. +27 −6 .sync.yml
  6. +5 −11 .travis.yml
  7. +9 −0 CHANGELOG.md
  8. +3 −1 Gemfile
  9. +4 −2 README.md
  10. +7 −1 Rakefile
  11. +3 −8 appveyor.yml
  12. +28 −6 metadata.json
  13. +25 −10 spec/acceptance/init_spec.rb
  14. +0 −1 spec/default_facts.yml
  15. +22 −14 spec/spec_helper.rb
  16. +8 −0 spec/spec_helper_acceptance.rb
  17. +28 −0 spec/spec_helper_local.rb
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#This file is generated by ModuleSync, do not edit.
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
/convert_report.txt
/update_report.txt
.DS_Store
.vscode/
.envrc
15 changes: 15 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@
/convert_report.txt
/update_report.txt
.DS_Store
.vscode/
.envrc
/appveyor.yml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
Empty file added .puppet-lint.rc
Empty file.
33 changes: 27 additions & 6 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
.gitignore:
required:
- ---.project

.gitlab-ci.yml:
unmanaged: true

.travis.yml:
docker_sets:
- set: docker/centos-7
Expand All @@ -8,6 +15,15 @@
secure: ""
branches:
- release
global_env:
- GEM_BOLT=true
remove_includes:
- env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4

.yardopts:
optional:
- --output-dir docs/

Gemfile:
optional:
Expand All @@ -25,14 +41,19 @@ Gemfile:
- 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)
.yardopts:
optional:
- --output-dir docs/

.gitlab-ci.yml:
unmanaged: true
spec/spec_helper.rb:
mock_with: ':rspec'
coverage_report: true
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system
- gem update --system $RUBYGEMS_VERSION
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.0
- 2.5.1
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- GEM_BOLT=true
matrix:
fast_finish: true
include:
-
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.0
rvm: 2.5.1
script: bundle exec rake beaker
services: docker
sudo: required
-
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.0
rvm: 2.5.1
script: bundle exec rake beaker
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.4
-
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
rvm: 2.1.9
branches:
only:
- master
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@

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).

## [0.3.1](https://github.com/puppetlabs/puppetlabs-puppet_conf/tree/0.3.1) (2019-04-04)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_conf/compare/0.3.0...0.3.1)

### Fixed

- pdksync - \(FM-7655\) Fix rubygems-update for ruby \< 2.3 [\#46](https://github.com/puppetlabs/puppetlabs-puppet_conf/pull/46) ([tphoney](https://github.com/tphoney))

## [0.3.0](https://github.com/puppetlabs/puppetlabs-puppet_conf/tree/0.3.0) (2018-09-27)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_conf/compare/0.2.1...0.3.0)

### Added

- pdksync - \(FM-7392\) - Puppet 6 Testing Changes [\#40](https://github.com/puppetlabs/puppetlabs-puppet_conf/pull/40) ([pmcmaw](https://github.com/pmcmaw))
- pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#38](https://github.com/puppetlabs/puppetlabs-puppet_conf/pull/38) ([tphoney](https://github.com/tphoney))

## 0.2.1

Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ group :development do
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::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
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]
Expand All @@ -31,6 +32,7 @@ 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']
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ This module provides the puppet_conf task. This task allows you to inspect and c

This module is compatible with Puppet Enterprise and Puppet Bolt.

* To run tasks with Puppet Enterprise, PE 2017.3 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must be Puppet agents.
* 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.

* To run tasks with Puppet Bolt, Bolt 0.5 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must have SSH or WinRM services enabled.
* To run tasks with Puppet Bolt, Bolt 1.0 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must have SSH or WinRM services enabled.

## Usage

Expand Down Expand Up @@ -49,6 +49,8 @@ For a complete list of `puppet.conf` options, see the [`puppet.conf`](https://do

## Limitations

To run acceptance tests against Windows machines, 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-puppet_conf/blob/master/metadata.json)

## Getting Help
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
require 'puppet-lint/tasks/puppet-lint'

def changelog_user
Expand All @@ -22,7 +23,7 @@ end

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
Expand Down Expand Up @@ -74,3 +75,8 @@ EOM
end
end

# 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)

11 changes: 3 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
version: 1.1.x.{build}
branches:
only:
- master
skip_commits:
message: /^\(?doc\)?.*/
clone_depth: 10
Expand All @@ -14,14 +17,6 @@ environment:
-
RUBY_VERSION: 24-x64
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21-x64
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24
Expand Down
34 changes: 28 additions & 6 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppet_conf",
"version": "0.3.0",
"version": "0.3.1",
"author": "puppetlabs",
"summary": "Tasks that manipulates a puppet configuration file",
"license": "Apache-2.0",
Expand All @@ -16,23 +16,45 @@
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7.0"
"5",
"6",
"7"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"14.04",
"16.04",
"18.04"
]
},
{
"operatingsystem": "windows",
"operatingsystemrelease": [
"2012 R2"
"2008 R2",
"2012 R2",
"10",
"2016"
]
}
],
Expand All @@ -43,7 +65,7 @@
}
],
"description": "Tasks that manipulates a puppet configuration file",
"pdk-version": "1.7.0",
"pdk-version": "1.8.0",
"template-url": "https://github.com/puppetlabs/pdk-templates",
"template-ref": "heads/master-0-g8fc95db"
}
"template-ref": "heads/master-0-gfde5699"
}
35 changes: 25 additions & 10 deletions spec/acceptance/init_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
# run a test task
require 'spec_helper_acceptance'

describe 'puppet_conf task' do
describe 'puppet configuration file' do
include Beaker::TaskHelper::Inventory
include BoltSpec::Run

describe 'puppet_conf' do
it 'set/get a puppet configuration' do
result = run_task(task_name: 'puppet_conf', params: 'action=set setting=vardir value=/tmp/bla')
expect_multiple_regexes(result: result, regexes: [%r{setting.*vardir}, %r{status.*/tmp/bla}, %r{section.*main}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}])
result = run_task(task_name: 'puppet_conf', params: 'action=get setting=vardir')
expect_multiple_regexes(result: result, regexes: [%r{setting.*vardir}, %r{status.*/tmp/bla}, %r{section.*main}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}])
result = task_run('puppet_conf', 'action' => 'set', 'setting' => 'vardir', 'value' => '/tmp/bla')

expect(result.first['status']).to eq 'success'
expect(result.first['result']['status']).to match %r{.*/tmp/bla}
expect(result.first['result']).to include 'setting' => 'vardir', 'section' => 'main'

result = task_run('puppet_conf', 'action' => 'get', 'setting' => 'vardir')

expect(result.first['status']).to eq 'success'
expect(result.first['result']['status']).to match %r{.*/tmp/bla}
expect(result.first['result']).to include 'setting' => 'vardir', 'section' => 'main'
end

it 'set/get a puppet configuration with section' do
result = run_task(task_name: 'puppet_conf', params: 'action=set setting=storeconfigs value=false section=master')
expect_multiple_regexes(result: result, regexes: [%r{setting.*storeconfigs}, %r{status.*false}, %r{section.*master}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}])
result = run_task(task_name: 'puppet_conf', params: 'action=get setting=storeconfigs section=master')
expect_multiple_regexes(result: result, regexes: [%r{setting.*storeconfigs}, %r{status.*false}, %r{section.*master}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}])
result = task_run('puppet_conf', 'action' => 'set', 'setting' => 'storeconfigs', 'value' => 'false', 'section' => 'master')

expect(result.first['status']).to eq 'success'
expect(result.first['result']).to include 'status' => 'false', 'setting' => 'storeconfigs', 'section' => 'master'

result = task_run('puppet_conf', 'action' => 'get', 'setting' => 'storeconfigs', 'section' => 'master')

expect(result.first['status']).to eq 'success'
expect(result.first['result']).to include 'status' => 'false', 'setting' => 'storeconfigs', 'section' => 'master'
end
end
end
1 change: 0 additions & 1 deletion spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# Facts specified here will override the values provided by rspec-puppet-facts.
---
concat_basedir: ""
ipaddress: "172.16.254.254"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"
Loading