Showing with 32 additions and 26 deletions.
  1. +2 −0 .sync.yml
  2. +2 −7 .travis.yml
  3. +8 −0 CHANGELOG.md
  4. +4 −4 Gemfile
  5. +11 −7 lib/puppet/provider/exec/powershell.rb
  6. +2 −5 lib/puppet/provider/exec/pwsh.rb
  7. +3 −3 metadata.json
2 changes: 2 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
include_todos: true
selected_profile: false
".travis.yml":
deploy_to_forge:
enabled: false
simplecov: true
before_install_pre:
- bash <(curl -s https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) -skip-sudo-check
Expand Down
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ before_install:
- rm -f Gemfile.lock
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
- '[ -z "$RUBYGEMS_VERSION" ] || yes | gem update --system $RUBYGEMS_VERSION'
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
- gem --version
- bundle -v
script:
Expand All @@ -22,9 +23,6 @@ stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
matrix:
fast_finish: true
include:
Expand All @@ -45,9 +43,6 @@ matrix:
os: osx
rvm: 2.5.3
stage: acceptance
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
- master
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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

## [v3.0.1](https://github.com/puppetlabs/puppetlabs-powershell/tree/v3.0.1) (2020-01-15)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-powershell/compare/v3.0.0...v3.0.1)

### Fixed

- \(MODULES-10389\) - Safeguard powershell provider loading [\#277](https://github.com/puppetlabs/puppetlabs-powershell/pull/277) ([michaeltlombardi](https://github.com/michaeltlombardi))

## [v3.0.0](https://github.com/puppetlabs/puppetlabs-powershell/tree/v3.0.0) (2020-01-06)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-powershell/compare/2.3.0...v3.0.0)
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ group :development do
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 "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "ruby-pwsh", require: false
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
Expand Down
18 changes: 11 additions & 7 deletions lib/puppet/provider/exec/powershell.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
require 'puppet/provider/exec'
begin
require 'ruby-pwsh'
rescue LoadError
raise 'Could not load the "ruby-pwsh" library; is the dependency module puppetlabs-pwshlib installed in this environment?'
end

Puppet::Type.type(:exec).provide :powershell, :parent => Puppet::Provider::Exec do
confine :operatingsystem => :windows

commands :powershell => Pwsh::Manager.powershell_path
confine :feature => :pwshlib

def self.powershell_path
begin
require 'ruby-pwsh'
Pwsh::Manager.powershell_path
rescue
nil
end
end
commands :powershell => self.powershell_path

desc <<-EOT
Executes Powershell commands. One of the `onlyif`, `unless`, or `creates`
Expand Down
7 changes: 2 additions & 5 deletions lib/puppet/provider/exec/pwsh.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
require 'puppet/provider/exec'
begin
require 'ruby-pwsh'
rescue LoadError
raise 'Could not load the "ruby-pwsh" library; is the dependency module puppetlabs-pwshlib installed in this environment?'
end

Puppet::Type.type(:exec).provide :pwsh, :parent => Puppet::Provider::Exec do
confine :feature => :pwshlib

desc <<-EOT
Executes PowerShell Core commands. One of the `onlyif`, `unless`, or `creates`
parameters should be specified to ensure the command is idempotent.
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-powershell",
"version": "3.0.0",
"version": "3.0.1",
"author": "puppetlabs",
"summary": "Adds a new exec provider for executing PowerShell commands.",
"license": "Apache-2.0",
Expand All @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/pwshlib",
"version_requirement": ">= 0.1.0 < 2.0.0"
"version_requirement": ">= 0.4.0 < 2.0.0"
}
],
"operatingsystem_support": [
Expand Down Expand Up @@ -79,5 +79,5 @@
],
"pdk-version": "1.15.0",
"template-url": "https://github.com/puppetlabs/pdk-templates#master",
"template-ref": "heads/master-0-g73e79b9"
"template-ref": "heads/master-0-g5676b3f"
}