Skip to content

Commit 5d7c5f8

Browse files
author
Erick Banks
authored
Merge pull request #259 from puppetlabs/kreeuwijk-patch-1
(MODULES-6356) Fixes a problem still remaining from MODULES-2904
2 parents 7d81226 + fcaea76 commit 5d7c5f8

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

lib/puppet/provider/sqlserver_instance/mssql.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ def format_cmd_args_array(switch, arr, cmd_args, use_discrete = false)
171171
if use_discrete
172172
arr.map.with_index { |var,i|
173173
if i == 0
174-
cmd_args << "#{switch}=\"#{var}\""
174+
cmd_args << "#{switch}=#{var}"
175175
else
176-
cmd_args << "\"#{var}\""
176+
cmd_args << "#{var}"
177177
end
178178
}
179179
else

spec/acceptance/sqlserver_instance_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def sql_query_is_user_sysadmin(username)
6060
context "Create an instance", {:testrail => ['88978', '89028', '89031', '89043', '89061']} do
6161

6262
before(:context) do
63-
@ExtraAdminUser = 'ExtraSQLAdmin'
63+
# Use a username with a space to test argument parsing works correctly
64+
@ExtraAdminUser = 'Extra SQLAdmin'
6465
pp = <<-MANIFEST
6566
user { '#{@ExtraAdminUser}':
6667
ensure => present,
@@ -83,7 +84,8 @@ def sql_query_is_user_sysadmin(username)
8384
features = ['SQLEngine', 'Replication', 'FullText', 'DQ']
8485

8586
it "create #{inst_name} instance", :tier_high => true do
86-
ensure_sqlserver_instance(features, inst_name,'present',"['Administrator','ExtraSQLAdmin']")
87+
host_computer_name = on(host, 'CMD /C ECHO %COMPUTERNAME%').stdout.chomp
88+
ensure_sqlserver_instance(features, inst_name,'present',"['Administrator','#{host_computer_name}\\#{@ExtraAdminUser}']")
8789

8890
validate_sql_install(host, {:version => version}) do |r|
8991
expect(r.stdout).to match(/#{Regexp.new(inst_name)}/)
@@ -95,7 +97,7 @@ def sql_query_is_user_sysadmin(username)
9597
end
9698

9799
it "#{inst_name} instance has ExtraSQLAdmin as a sysadmin", :tier_low => true do
98-
run_sql_query(host, run_sql_query_opts(inst_name, sql_query_is_user_sysadmin('ExtraSQLAdmin'), expected_row_count = 1))
100+
run_sql_query(host, run_sql_query_opts(inst_name, sql_query_is_user_sysadmin(@ExtraAdminUser), expected_row_count = 1))
99101
end
100102

101103
it "remove #{inst_name} instance", :tier_high => true do

spec/spec_helper_acceptance.rb

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@
2727
# Install PE
2828
run_puppet_install_helper
2929

30-
# Install PE License onto Master
31-
install_pe_license(master)
30+
# Install PE License onto Master, if one exists.
31+
install_pe_license(master) unless hosts_as("master").empty?
32+
33+
# Determine root path of local module source.
34+
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
35+
# In CI install from staging forge, otherwise from local
36+
staging = { :module_name => 'puppetlabs-sqlserver' }
37+
local = { :module_name => 'sqlserver', :source => proj_root }
3238

3339
unless ENV['MODULE_provision'] == 'no'
3440
hosts_as("sql_host").each do |agent|
@@ -66,16 +72,8 @@
6672
on(agent, puppet("module install #{dep}"))
6773
end
6874

69-
# Determine root path of local module source.
70-
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
71-
72-
# In CI install from staging forge, otherwise from local
73-
staging = { :module_name => 'puppetlabs-sqlserver' }
74-
local = { :module_name => 'sqlserver', :source => proj_root }
75-
7675
# Install sqlserver dependencies.
7776
on(agent, puppet('module install puppetlabs-stdlib'))
78-
on(master, puppet('module install puppetlabs-stdlib'))
7977

8078
# Mount windows 2012R2 ISO to allow install of .NET 3.5 Windows Feature
8179
iso_opts = {
@@ -88,6 +86,15 @@
8886
# Install sqlserver module from local source.
8987
# See FM-5062 for more details.
9088
copy_module_to(agent, local)
91-
copy_module_to(master, local)
89+
end
90+
91+
hosts_as("master").each do |host|
92+
# Install sqlserver dependencies.
93+
on(host, puppet('module install puppetlabs-stdlib'))
94+
95+
# Install sqlserver module from local source.
96+
# See FM-5062 for more details.
97+
local = { :module_name => 'sqlserver', :source => proj_root }
98+
copy_module_to(host, local)
9299
end
93100
end

spec/unit/puppet/provider/sqlserver_instance_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def stub_uninstall(args, installed_features, exit_code = 0)
6060
cmd_args << "/SECURITYMODE=SQL"
6161
end
6262

63-
# wrap each arg in doublequotes
64-
admin_args = execute_args[:sql_sysadmin_accounts].map { |a| "\"#{a}\"" }
63+
# Extrace the SQL Sysadmins
64+
admin_args = execute_args[:sql_sysadmin_accounts].map { |a| "#{a}" }
6565
# prepend first arg only with CLI switch
6666
admin_args[0] = "/SQLSYSADMINACCOUNTS=" + admin_args[0]
6767
cmd_args += admin_args

0 commit comments

Comments
 (0)