Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from puppetlabs/updates_from_gene
Browse files Browse the repository at this point in the history
Update PDK, spec tests, and docs
  • Loading branch information
glennsarti authored Apr 3, 2019
2 parents 89bcda7 + 4543928 commit fc47616
Show file tree
Hide file tree
Showing 20 changed files with 478 additions and 140 deletions.
4 changes: 3 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
powershell: "puppetlabs/powershell"
stdlib: "puppetlabs/stdlib"

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git/
.*.sw[op]
.metadata
.yardoc
Expand All @@ -13,10 +14,11 @@
/Gemfile.lock
/junit/
/log/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/

/convert_report.txt
/update_report.txt
.DS_Store
37 changes: 37 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
/appveyor.yml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
26 changes: 22 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
---
require: rubocop-rspec
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Include:
- "./**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
- Gemfile
- Rakefile
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- 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 Expand Up @@ -62,14 +70,24 @@ Style/TrailingCommaInLiteral:
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
Style/EndOfLine:
Enabled: false
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Exclude:
- lib/puppet/parser/functions/**/*
- spec/**/*
Style/WordArray:
EnforcedStyle: brackets
Style/CollectionMethods:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Expand Down
16 changes: 16 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
.gitlab-ci.yml:
delete: true
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
Rakefile:
requires:
- 'puppet-strings/tasks'
spec/spec_helper.rb:
mock_with: ':rspec'
coverage_report: true
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
before_install:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem update bundler
- rm -f Gemfile.lock
- gem update --system $RUBYGEMS_VERSION
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.3.1
- 2.1.7
- 2.5.1
env:
- PUPPET_GEM_VERSION="~> 4.0" CHECK=spec
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
matrix:
fast_finish: true
include:
-
env: CHECK=rubocop
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK="syntax lint"
env: CHECK=parallel_spec
-
env: CHECK=metadata_lint
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4
branches:
only:
- master
Expand Down
1 change: 0 additions & 1 deletion .yardopts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--markup markdown
--output-dir docs/
84 changes: 15 additions & 69 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

def location_for(place_or_version, fake_version = nil)
if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
elsif place_or_version =~ %r{\Afile:\/\/(.*)}
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
else
[place_or_version, { require: false }]
end
end
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
file_url_regex = %r{\Afile:\/\/(?<path>.*)}

def gem_type(place_or_version)
if place_or_version =~ %r{\Agit[:@]}
:git
elsif !place_or_version.nil? && place_or_version.start_with?('file:')
:file
if place_or_version && (git_url = place_or_version.match(git_url_regex))
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
else
:gem
[place_or_version, { require: false }]
end
end

Expand All @@ -28,84 +21,37 @@ 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::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

puppet_version = ENV['PUPPET_GEM_VERSION']
puppet_type = gem_type(puppet_version)
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']

def puppet_older_than?(version)
puppet_version = ENV['PUPPET_GEM_VERSION']
!puppet_version.nil? &&
Gem::Version.correct?(puppet_version) &&
Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup))
end

gems = {}

gems['puppet'] = location_for(puppet_version)

# If facter or hiera versions have been specified via the environment
# variables, use those versions. If not, and if the puppet version is < 3.5.0,
# use known good versions of both for puppet < 3.5.0.
if facter_version
gems['facter'] = location_for(facter_version)
elsif puppet_type == :gem && puppet_older_than?('3.5.0')
gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false]
end
# variables

if hiera_version
gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION'])
elsif puppet_type == :gem && puppet_older_than?('3.5.0')
gem['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false]
end

if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0'))
# For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows
if puppet_type == :gem
gems['ffi'] = ['1.9.0', require: false]
gems['minitar'] = ['0.5.4', require: false]
gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false]
gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false]
gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false]
gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false]
else
gems['ffi'] = ['~> 1.9.0', require: false]
gems['minitar'] = ['~> 0.5.4', require: false]
gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false]
gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false]
gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false]
gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false]
end

gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false]

if RUBY_VERSION.start_with?('1.')
gems['win32console'] = ['1.3.2', require: false]
# sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x
gems['sys-admin'] = ['1.5.6', require: false]
end
gems['facter'] = location_for(facter_version) if facter_version
gems['hiera'] = location_for(hiera_version) if hiera_version

# Puppet < 3.7.0 requires these.
# Puppet >= 3.5.0 gem includes these as requirements.
# The following versions are tested to work with 3.0.0 <= puppet < 3.7.0.
gems['win32-api'] = ['1.4.8', require: false]
gems['win32-taskscheduler'] = ['0.2.2', require: false]
gems['windows-api'] = ['0.4.3', require: false]
gems['windows-pr'] = ['1.2.3', require: false]
elsif Gem.win_platform?
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
gems['win32-dir'] = ['<= 0.4.9', require: false]
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
gems['win32-process'] = ['<= 0.7.5', require: false]
gems['win32-security'] = ['<= 0.2.5', require: false]
gems['win32-service'] = ['<= 0.8.8', require: false]
gems['win32-service'] = ['0.8.8', require: false]
end

gems.each do |gem_name, gem_params|
Expand Down
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
![](https://img.shields.io/puppetforge/pdk-version/puppetlabs/windows_puppet_certificates.svg?style=popout)
![](https://img.shields.io/puppetforge/v/puppetlabs/windows_puppet_certificates.svg?style=popout)
![](https://img.shields.io/puppetforge/dt/puppetlabs/windows_puppet_certificates.svg?style=popout)
[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-windows_puppet_certificates.svg?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-windows_puppet_certificates)

# windows_puppet_certificates

#### Table of Contents

1. [Description](#description)
2. [Usage - Configuration options and additional functionality](#usage)
3. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
4. [Limitations - OS compatibility, etc.](#limitations)
2. [Usage](#usage)
3. [Reference](#reference)
4. [Changelog](#changelog)
5. [Limitations](#limitations)
6. [Contributing](#contributing)

## Description

Expand Down Expand Up @@ -37,24 +43,25 @@ class { 'windows_puppet_certificates':
manage_master_cert => true,
manage_client_cert => true,
}
include windows_puppet_certificates
```

## Reference

### windows_puppet_certificates
This module is documented via
`pdk bundle exec puppet strings generate --format markdown`.
Please see [REFERENCE.md](REFERENCE.md) for more info.

#### manage_master_cert
## Changelog

When set to true the module will manage the Puppet Master CA certificate into the computer Trusted Root CA certificate store. By default this is set to true
[CHANGELOG.md](CHANGELOG.md) is generated prior to each release via
`pdk bundle exec rake changelog`. This proecss relies on labels that are applied
to each pull request.

#### manage_client_cert
## Limitations

When set to true the module will manage the Puppet Client certificate, and private key, into the computer Personal certificate store. By default this is set to false, as importing a private key should be an explicit decision.
Currently the module only supports `ensure => present`, that is the module can only add the certificates, and ensure they exist.

The public key is marked as Not Exportable in the certificate store.
## Contributing

## Limitations
Pull requests are welcome!

Currently the module only supports `ensure => present`, that is the module can only add the certificates, and ensure they exist.
Loading

0 comments on commit fc47616

Please sign in to comment.