Skip to content

Commit 325eef1

Browse files
author
Travis Fields
committed
Merge branch '1.0.x'
2 parents 9652d82 + 22b8229 commit 325eef1

File tree

6 files changed

+62
-38
lines changed

6 files changed

+62
-38
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
##2014-08-25 - Supported Release 1.0.3
2+
###Summary
3+
4+
This release updates the tests to verify that powershell continues to function on x64-native ruby.
5+
16
##2014-07-15 - Supported Release 1.0.2
27
###Summary
38

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gem "puppet", *location_for(ENV['PUPPET_LOCATION'] || '~> 3.4.0')
1414
gem "facter", *location_for(ENV['FACTER_LOCATION'] || '~> 1.6')
1515
gem "hiera", *location_for(ENV['HIERA_LOCATION'] || '~> 1.0')
1616

17+
beaker_version = ENV['BEAKER_VERSION']
1718
group :development, :test do
1819
gem 'rspec'
1920
gem 'mocha'
@@ -25,6 +26,11 @@ group :development, :test do
2526
gem 'puppet-lint', :require => false
2627
gem 'pry', :require => false
2728
gem 'simplecov', :require => false
29+
if beaker_version
30+
gem 'beaker', *location_for(beaker_version)
31+
else
32+
gem 'beaker', :require => false, :platforms => :ruby
33+
end
2834
gem 'beaker-rspec', :require => false, :platforms => :ruby
2935
end
3036

Rakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ RSpec::Core::RakeTask.new('beaker:rspec:test:pe',:host) do |t,args|
1818
t.rspec_opts = '--color'
1919
t.verbose = true
2020
end
21+
22+
RSpec::Core::RakeTask.new('beaker:rspec:test:git',:host) do |t,args|
23+
args.with_defaults({:host => 'default'})
24+
ENV['BEAKER_set'] = args[:host]
25+
t.pattern = 'spec/acceptance'
26+
t.rspec_opts = '--color'
27+
t.verbose = true
28+
end

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-powershell",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"author": "Puppet Labs",
55
"summary": "A PowerShell provider for puppet.",
66
"license": "Apache-2.0",
@@ -25,7 +25,7 @@
2525
"requirements": [
2626
{
2727
"name": "pe",
28-
"version_requirement": ">= 3.2.0 < 3.4.0"
28+
"version_requirement": "3.x"
2929
},
3030
{
3131
"name": "puppet",

spec/acceptance/exec_powershell_spec.rb

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
require 'spec_helper_acceptance'
22

3-
describe 'powershell provider:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4-
shared_context 'powershell plugin sync' do
5-
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
6-
copy_root_module_to(master, {:module_name => 'powershell', :source => proj_root})
7-
on agents, puppet("plugin download --server #{master}")
8-
end
9-
3+
describe 'powershell provider:' do #, :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
104
shared_examples 'should fail' do |manifest, error_check|
115
it 'should throw an error' do
126
expect { apply_manifest(manifest, :catch_failures => true) }.to raise_error(error_check)
@@ -20,7 +14,7 @@
2014
end
2115

2216
describe 'should run successfully' do
23-
include_context 'powershell plugin sync'
17+
2418
p1 = <<-MANIFEST
2519
exec{'TestPowershell':
2620
command => 'Get-Process > c:/process.txt',
@@ -38,7 +32,7 @@
3832
end
3933

4034
describe 'should be able to access the files after execution' do
41-
include_context 'powershell plugin sync'
35+
4236
p2 = <<-MANIFEST
4337
exec{"TestPowershell":
4438
command => 'Get-Service *puppet* | Out-File -FilePath C:/services.txt -Encoding UTF8',
@@ -54,7 +48,6 @@
5448
end
5549

5650
describe 'should catch and rethrow exceptions up to puppet' do
57-
include_context 'powershell plugin sync'
5851
pexception = <<-MANIFEST
5952
exec{'PowershellException':
6053
provider => powershell,
@@ -65,7 +58,6 @@
6558
end
6659

6760
describe 'should be able to execute a ps1 file provided' do
68-
include_context 'powershell plugin sync'
6961
p2 = <<-MANIFEST
7062
file{'c:/services.ps1':
7163
content => '#{File.open(File.join(File.dirname(__FILE__), 'files/services.ps1')).read()}'
@@ -84,10 +76,9 @@
8476
end
8577

8678
describe 'passing parameters to the ps1 file' do
87-
include_context 'powershell plugin sync'
88-
outfile = 'C:/temp/svchostprocess.txt'
79+
outfile = 'C:/temp/svchostprocess.txt'
8980
processName = 'svchost'
90-
pp = <<-MANIFEST
81+
pp = <<-MANIFEST
9182
$process = '#{processName}'
9283
$outFile = '#{outfile}'
9384
file{'c:/param_script.ps1':
@@ -107,7 +98,6 @@
10798
end
10899

109100
describe 'should execute using 64 bit powershell' do
110-
include_context 'powershell plugin sync'
111101
p3 = <<-MANIFEST
112102
$maxArchNumber = $::architecture? {
113103
/(?i)(i386|i686|x86)$/ => 4,
@@ -135,7 +125,6 @@
135125
end
136126

137127
describe 'test admin rights' do
138-
include_context 'powershell plugin sync'
139128
ps1 = <<-PS1
140129
$id = [Security.Principal.WindowsIdentity]::GetCurrent()
141130
$pr = New-Object Security.Principal.WindowsPrincipal $id
@@ -145,7 +134,6 @@
145134
end
146135

147136
describe 'test import-module' do
148-
include_context 'powershell plugin sync'
149137
pimport = <<-PS1
150138
$mods = Get-Module -ListAvailable | Sort
151139
if($mods.Length -lt 1) {

spec/spec_helper_acceptance.rb

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
1-
require 'beaker-rspec'
2-
require 'rspec'
1+
require 'beaker-rspec/spec_helper'
2+
require 'beaker-rspec/helpers/serverspec'
3+
4+
5+
UNSUPPORTED_PLATFORMS = ['debian', 'ubuntu', 'Solaris']
6+
7+
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
8+
is_foss = (ENV['IS_PE'] == 'no' || ENV['IS_PE'] == 'false') ? true : false
9+
if hosts.first.is_pe? && !is_foss
10+
install_pe
11+
else
12+
version = ENV['PUPPET_VERSION'] || '3.6.2'
13+
download_url = ENV['WIN_DOWNLOAD_URL'] || 'http://downloads.puppetlabs.com/windows/'
14+
hosts.each do |host|
15+
if host['platform'] =~ /windows/i
16+
install_puppet_from_msi(host,
17+
{
18+
:win_download_url => download_url,
19+
:version => version
20+
})
21+
end
22+
end
23+
end
24+
25+
step "Install Powershell to default host"
26+
on default, "mkdir -p #{default['distmoduledir']}/powershell"
27+
result = on default, "echo #{default['distmoduledir']}/powershell"
28+
target = result.raw_output.chomp
29+
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
30+
%w(lib metadata.json).each do |file|
31+
scp_to default, "#{proj_root}/#{file}", target
32+
end
33+
end
334

435
RSpec.configure do |c|
36+
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
37+
538
# Readable test descriptions
639
c.formatter = :documentation
740

841
# Configure all nodes in nodeset
942
c.before :suite do
10-
hosts.each do |host|
11-
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
12-
end
43+
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
1344
end
1445
c.after :suite do
1546
absent_files = 'file{["c:/services.txt","c:/process.txt"]: ensure => absent }'
1647
apply_manifest(absent_files)
1748
end
1849
end
1950

20-
UNSUPPORTED_PLATFORMS = [ 'debian','ubuntu', 'Solaris' ]
21-
22-
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
23-
if hosts.first.is_pe?
24-
install_pe
25-
else
26-
install_puppet
27-
end
28-
hosts.each do |host|
29-
on hosts, "mkdir -p #{host['distmoduledir']}"
30-
end
31-
end
32-
33-

0 commit comments

Comments
 (0)