Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dce80eb

Browse files
committedOct 17, 2022
Error fixing
1 parent 0b027e5 commit dce80eb

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed
 

‎manifests/compose.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@
8989
ensure_packages(['curl'])
9090
}
9191

92+
$compose_install = "curl -s -S -L ${proxy_opt} ${docker_compose_url} -o ${docker_compose_location_versioned}"
9293
exec { "Install Docker Compose ${version}":
9394
path => '/usr/bin/',
9495
cwd => '/tmp',
95-
command => ['curl', '-s', '-S', '-L', $proxy_opt, $docker_compose_url, '-o', $docker_compose_location_versioned],
96+
command => $compose_install,
9697
creates => $docker_compose_location_versioned,
9798
require => Package['curl'],
9899
}

‎manifests/install.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
}
114114
}
115115

116-
$fail_restart_command = ['SC.exe', 'failure', 'Docker', 'reset= 432000', 'actions= restart/30000/restart/60000/restart/60000']
116+
$fail_restart_command = 'SC.exe failure Docker reset= 432000 actions= restart/30000/restart/60000/restart/60000'
117117
exec { 'service-restart-on-failure':
118118
command => $fail_restart_command,
119119
refreshonly => true,

‎manifests/plugin.pp

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
}
6969
)
7070

71-
$exec_install = [$docker_command, 'install', $docker_plugin_install_flags]
72-
$unless_install = [$docker_command, 'ls', "--format='{{.PluginReference}}' | grep -w ${plugin_name}"]
71+
$exec_install = "${docker_command} install ${docker_plugin_install_flags}"
72+
$unless_install = "${docker_command} ls --format='{{.PluginReference}}' | grep -w ${plugin_name}"
7373

7474
exec { "plugin install ${plugin_name}":
7575
command => $exec_install,
@@ -86,7 +86,7 @@
8686
)
8787

8888
$exec_rm = [$docker_command, 'rm', $docker_plugin_remove_flags]
89-
$onlyif_rm = [$docker_command, 'ls', "--format='{{.PluginReference}}' | grep -w ${plugin_name}"]
89+
$onlyif_rm = "${docker_command} ls --format='{{.PluginReference}}' | grep -w ${plugin_name}"
9090

9191
exec { "plugin remove ${plugin_name}":
9292
command => $exec_rm,
@@ -106,7 +106,7 @@
106106
)
107107

108108
$exec_enable = [$docker_command, 'enable', $docker_plugin_enable_flags]
109-
$onlyif_enable = [$docker_command, 'ls', '-f', "enabled=false --format='{{.PluginReference}}' | grep -w ${plugin_name}"]
109+
$onlyif_enable = "${docker_command} ls -f enabled=false --format='{{.PluginReference}}' | grep -w ${plugin_name}"
110110

111111
exec { "plugin enable ${plugin_name}":
112112
command => $exec_enable,
@@ -117,7 +117,7 @@
117117
}
118118
} elsif $enabled == false {
119119
$else_command = [$docker_command, 'disable', $plugin_name]
120-
$else_unless = [$docker_command, 'ls', '-f', "enabled=false --format='{{.PluginReference}}' | grep -w ${plugin_name}"]
120+
$else_unless = "${docker_command} ls -f enabled=false --format='{{.PluginReference}}' | grep -w ${plugin_name}"
121121

122122
exec { "disable ${plugin_name}":
123123
command => $else_command,

‎manifests/run.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@
527527

528528
if $ensure == 'absent' {
529529
if $facts['os']['family'] == 'windows' {
530-
$absent_stop_command = [$docker_command, 'stop', "--time=${stop_wait_time}", $sanitised_title]
531-
$absent_stop_onlyif = [$docker_command, 'inspect', $sanitised_title]
530+
$absent_stop_command = "${docker_command} stop --time=${stop_wait_time} ${sanitised_title}"
531+
$absent_stop_onlyif = "${docker_command} inspect ${sanitised_title}"
532532

533533
exec { "stop container ${service_prefix}${sanitised_title}":
534534
command => $absent_stop_command,
@@ -550,7 +550,7 @@
550550
}
551551
}
552552
$absent_remove_command = [$docker_command, 'rm', '-v', $sanitised_title]
553-
$absent_remove_onlyif = [$docker_command, 'inspect', $sanitised_title]
553+
$absent_remove_onlyif = "${docker_command} inspect ${sanitised_title}"
554554

555555
exec { "remove container ${service_prefix}${sanitised_title}":
556556
command => $absent_remove_command,

‎manifests/services.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
)
134134

135135
$exec_create = [$docker_command, 'create', '--name', $docker_service_create_flags]
136-
$unless_create = ['docker', 'service', 'ps', $service_name]
136+
$unless_create = "docker service ps ${service_name}"
137137

138138
exec { "${title} docker service create":
139139
command => $exec_create,

‎spec/shared_examples/compose.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
is_expected.to contain_exec("Install Docker Compose #{version}").with(
6363
'path' => '/usr/bin/',
6464
'cwd' => '/tmp',
65-
'command' => ['curl', '-s', '-S', '-L', proxy_opt, docker_compose_url, '-o', docker_compose_location_versioned],
65+
'command' => "curl -s -S -L #{proxy_opt} #{docker_compose_url} -o #{docker_compose_location_versioned}",
6666
'creates' => docker_compose_location_versioned,
6767
).that_requires(
6868
'Package[curl]',

‎spec/shared_examples/install.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141

142142
it {
143143
is_expected.to contain_exec('service-restart-on-failure').with(
144-
'command' => ['SC.exe', 'failure', 'Docker', 'reset= 432000', 'actions= restart/30000/restart/60000/restart/60000'],
144+
'command' => 'SC.exe failure Docker reset= 432000 actions= restart/30000/restart/60000/restart/60000',
145145
'refreshonly' => true,
146146
'logoutput' => true,
147147
'provider' => 'powershell',

‎spec/shared_examples/plugin.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
'settings' => settings,
2525
)
2626

27-
exec_install = [docker_command, 'install', docker_plugin_install_flags]
28-
unless_install = [docker_command, 'ls', "--format='{{.PluginReference}}' | grep -w #{plugin_name}"]
27+
exec_install = "#{docker_command} install #{docker_plugin_install_flags}"
28+
unless_install = "#{docker_command} ls --format='{{.PluginReference}}' | grep -w #{plugin_name}"
2929

3030
it {
3131
is_expected.to contain_exec("plugin install #{plugin_name}").with(
@@ -44,7 +44,7 @@
4444
)
4545

4646
exec_rm = [docker_command, 'rm', docker_plugin_remove_flags]
47-
onlyif_rm = [docker_command, 'ls', "--format='{{.PluginReference}}' | grep -w #{plugin_name}"]
47+
onlyif_rm = "#{docker_command} ls --format='{{.PluginReference}}' | grep -w #{plugin_name}"
4848

4949
it {
5050
is_expected.to contain_exec("plugin remove #{plugin_name}").with(
@@ -65,7 +65,7 @@
6565
)
6666

6767
exec_enable = [docker_command, 'enable', docker_plugin_enable_flags]
68-
onlyif_enable = [docker_command, 'ls', '-f', "enabled=false --format='{{.PluginReference}}' | grep -w #{plugin_name}"]
68+
onlyif_enable = "#{docker_command} ls -f enabled=false --format='{{.PluginReference}}' | grep -w #{plugin_name}"
6969

7070
it {
7171
is_expected.to contain_exec("plugin enable #{plugin_name}").with(
@@ -78,7 +78,7 @@
7878
}
7979
else
8080
else_command = [docker_command, 'disable', plugin_name]
81-
else_unless = [docker_command, 'ls', '-f', "enabled=false --format='{{.PluginReference}}' | grep -w #{plugin_name}"]
81+
else_unless = "#{docker_command} ls -f enabled=false --format='{{.PluginReference}}' | grep -w #{plugin_name}"
8282

8383
it {
8484
is_expected.to contain_exec("disable #{plugin_name}").with(

‎spec/shared_examples/services.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
)
5858

5959
exec_create = [docker_command, 'create', '--name', docker_service_create_flags]
60-
unless_create = ['docker', 'service', 'ps', (service_name == :undef ? '' : service_name).to_s]
60+
unless_create = "docker service ps #{service_name == :undef ? '' : service_name}"
6161

6262
it {
6363
is_expected.to contain_exec("#{title} docker service create").with(

0 commit comments

Comments
 (0)
Please sign in to comment.