(maint) Fix changelog release dates
The release dates for v2.0.0 and v2.0.1 had the incorrect date. This commit ammends the release date [ci skip]
Merge pull request #111 from glennsarti/ticket/maint/fix/year-typo
(maint) Fix changelog release dates
* stable: (maint) Fix changelog release dates (FM-5241) Release Powershell 2.0.1
(MODULES-3347) Handle PS Verbose Output in Tests
When the PowerShell Informational Output Streams were implemented in MODULES-3137 tests were added to ensure each output stream produced the correct text. The Verbose test proved brittle because we forced $VerbosePreference to Continue, which caused extra verbose messages to be written because of PowerShell module auto loading. This fixes the test to look for our text instead of requiring only our text Also update the Debug / Warning / Error tests to use randomly generated output, so that we don't receive false positive results. Paired-with: Ethan Brown <ethan@puppet.com>
* pr/112: (MODULES-3347) Handle PS Verbose Output in Tests closes #112
(MODULES-2634) Add additional try/catch tests
- Verify that we have actually executed a try / catch and exit with the expected status Paired-with: James Pogran <james.pogran@puppet.com>
(MODULES-2634) Rewrite try/catch acceptance tests
- The tests introduced in 14e0be3 were insufficient at verifying that code inside of a try or catch block was actually being executed due to how the assertions were setup. Rewrite the tests to separately verify that code inside a try or a catch block will produce a file, whose contents can then be verified. Also assert that code we do not expect to be executed does not write files. Paired-with: James Pogran <james.pogran@puppet.com>
(maint) Remove require_relative for Ruby 1.8.7
- Because this module can be run on Puppet 3.8, which can run on the system Ruby of a Linux machine (such as CentOS 6), it's possible that the cdoe will be parsed in a Ruby 1.8.7 environment. Move to require with a manually constructed path, which is the effectively the same thing as require_relative in newer Rubies.
Merge pull request #114 from Iristyle/maint/stable/ruby-187-compatibi…
…lity (maint) Remove require_relative for Ruby 1.8.7
(MODULES-3347) Handle PS Verbose Output in Tests
When the PowerShell Informational Output Streams were implemented in MODULES-3137 tests were added to ensure each output stream produced the correct text. The Verbose test proved brittle because we forced $VerbosePreference to Continue, which caused extra verbose messages to be written because of PowerShell module auto loading. This fixes the test to look for our text instead of requiring only our text Also update the Debug / Warning / Error tests to use randomly generated output, so that we don't receive false positive results. Paired-with: Ethan Brown <ethan@puppet.com>
(MODULES-3406) Refactor PowerShell code execution to function
- Simple change in preparation of a larger refactor, breaking out the main code path inside invoke_ps_command.erb to a new function Invoke-PowerShellUserCode That cmdlet is now executed as the only thing that this script does. This will allow this templated file to later be reduced to only invoking this cmdlet. Note that there are a few variables defined in global scope that now need to be explicitly declared as such, with their creation and access now living inside the new function as part of the refactor: $global:puppetPSHost - Puppet.PuppetPSHost $global:runspace - System.Management.Automation.Runspaces.Runspace $global:environmentVariables - HashTable $global:psVariables - Array
(MODULES-3406) Load PowerShell init code only once
- Previously, we asked the PowerShell parser to load way more code than necessary, which can slow it down. Instead, pre-load all the code required for our process, then only ask for user specified code to be parsed and executed per each call.
Merge pull request #113 from Iristyle/ticket/master/MODULES-2634-try-…
…catch-tests-redux-again (MODULES-2634) Try / Catch Test Updates
(MODULES-3406) Inline user PowerShell code string
- Previously the ERB template engine was created for a simple block of user code to execute. Instead inline the small bit of code to avoid any associated performance penalties with reading files off disk, engaging the ERB engine, etc. This may not result in much of a measurable gain
(maint) Remove test file from repository
This commit removes a binary test file which was committed in error.
Merge pull request #117 from glennsarti/master
(MODULES-2634) Remove unnecessary binary test file
(MODULES-2634) Fix tests for non-Windows agents
- These tests were initially validated against a local definition that only included Windows agents. However, in CI, there are masters that are configured as agents as well, and some of these tests don't make sense. Refactor all the tests to run manifests only on Windows agents.
Merge pull request #118 from Iristyle/ticket/master/MODULES-2634-fixu…
…p-tests-for-non-Windows-agents (MODULES-2634) Fix tests for non-Windows agents
Merge remote-tracking branch 'origin/stable'
* origin/stable: (MODULES-3347) Handle PS Verbose Output in Tests (maint) Remove require_relative for Ruby 1.8.7
(MODULES-2634) Fix PS try/catch in puppet 3.X
In this module, if a user using puppet 3.X uses a try/catch statement without a newline at the end it will either be entirely ignored or it will fail. This is an artifact of how we are using powershell in older puppet versions, i.e. through a file redirection into the Command paramter to powershell.exe. If we add a newline to the end of the tempfile that is passed to PS, we can execute any logic construct in PS. This fix uses `puts` instead of `write`, which automatically adds a newline to the end of the script content.
Merge pull request #119 from jpogran/ticket/master/MODULES-2634-try-c…
…atch-fix-in-v1 (MODULES-2634) Fix PS try/catch in puppet 3.X
(MODULES-2634) PowerShell Module doesn't run template with try/catch
Previously, the PowerShell module was not correctly executing code inside of try / catch blocks in a templated script on Windows 2008 R2 x64, PE version 3.2.3. This commit appends a newline to the manifest, since PowerShell needs multiple lines to correctly parse it.
Merge pull request #120 from DLuCJ/master
(MODULES-2634) PowerShell Module doesn't run template with try/catch
Module updated with lastest modsync settings
Merge pull request #122 from glennsarti/stable
(MODULES-3536) modsync update
Merge remote-tracking branch 'origin/stable'
* origin/stable: (MODULES-3536) modsync update
Merge pull request #115 from Iristyle/ticket/stable/MODULES-3406-opti…
…mize-powershell-parse-time (MODULES-3406) Optimize PowerShell parse time
* stable: (MODULES-3406) Inline user PowerShell code string (MODULES-3406) Load PowerShell init code only once (MODULES-3406) Refactor PowerShell code execution to function
Merge pull request #124 from glennsarti/ticket/stable/PUP6473
(maint) modulesync 99efa6139
Merge pull request #126 from glennsarti/ticket/stable/PUP6477
(maint) modulesync 724153ca2
(MODULES-3468) Update README.md
This commit - Adds the minimum powershell version to the Limitations section - Removes Window 2003 as a supported OS for this module - Adds a space in the markdown headers between the hash and text. While this renders correctly in GitHub and the Puppet Forge some editors and parsers require a white space. [ci skip]
Merge pull request #127 from glennsarti/ticket/master/modules-3468-mi…
…n-ps-ver (MODULES-3468) Update README.md
Merge branch 'master' into stable
* master: (MODULES-3468) Update README.md (MODULES-2634) PowerShell Module doesn't run template with try/catch (MODULES-2634) Fix PS try/catch in puppet 3.X (MODULES-2634) Fix tests for non-Windows agents (maint) Remove test file from repository (maint) modsync update (MODULES-2634) Rewrite try/catch acceptance tests (MODULES-2634) Add additional try/catch tests (MODULES-3347) Handle PS Verbose Output in Tests
(FM-5344) Prepare for release 2.0.2
This commit prepares for the release of version 2.0.2 of the powershell module. - Update CHANGELOG - Update version in metadata [ci skip]
Merge pull request #128 from glennsarti/ticket/stable/FM-5344-release…
…-2.0.2 (FM-5344) Prepare for release 2.0.2