Skip to content

Commit f3d5fb3

Browse files
committed
Properly format prepare_host
This uses correct heredoc descriptions and directly passes them into the right methods, without additional variables.
1 parent d96aa7e commit f3d5fb3

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

spec/support/acceptance/prepare_host.rb

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,31 @@ def prepare_host
55
shell('yum clean all --verbose; rm -rf /etc/yum.repos.d/Zabbix*.repo')
66
end
77

8-
cleanup_puppet = <<-SHELL
9-
$services = $facts['os']['family'] ? {
10-
'RedHat' => ['zabbix-server', 'httpd'],
11-
'Debian' => ['zabbix-server', 'apache2'],
12-
default => [],
13-
}
14-
service { $services:
15-
ensure => stopped
16-
}
8+
apply_manifest <<~PUPPET
9+
$services = $facts['os']['family'] ? {
10+
'RedHat' => ['zabbix-server', 'httpd'],
11+
'Debian' => ['zabbix-server', 'apache2'],
12+
default => [],
13+
}
14+
service { $services:
15+
ensure => stopped
16+
}
1717
18-
$packages = $facts['os']['family'] ? {
19-
'RedHat' => ['zabbix-server-pgsql', 'zabbix-server-pgsql-scl', 'zabbix-web', 'zabbix-web-pgsql', 'zabbix-web-pgsql-scl', 'zabbix-frontend-php', 'zabbix-sql-scripts'],
20-
'Debian' => ['zabbix-server-pgsql', 'zabbix-web-pgsql', 'zabbix-frontend-php', 'zabbix-sql-scripts'],
21-
default => [],
22-
}
23-
package { $packages:
24-
ensure => purged
25-
}
26-
SHELL
18+
$packages = $facts['os']['family'] ? {
19+
'RedHat' => ['zabbix-server-pgsql', 'zabbix-server-pgsql-scl', 'zabbix-web', 'zabbix-web-pgsql', 'zabbix-web-pgsql-scl', 'zabbix-frontend-php', 'zabbix-sql-scripts'],
20+
'Debian' => ['zabbix-server-pgsql', 'zabbix-web-pgsql', 'zabbix-frontend-php', 'zabbix-sql-scripts'],
21+
default => [],
22+
}
23+
package { $packages:
24+
ensure => purged
25+
}
26+
PUPPET
2727

28-
cleanup_script = <<-SHELL
29-
/opt/puppetlabs/puppet/bin/gem uninstall zabbixapi -a
30-
rm -f /etc/zabbix/.*done
31-
if id postgres > /dev/null 2>&1; then
32-
su - postgres -c "psql -c 'drop database if exists zabbix_server;'"
33-
fi
28+
shell <<~SHELL
29+
/opt/puppetlabs/puppet/bin/gem uninstall zabbixapi -a
30+
rm -f /etc/zabbix/.*done
31+
if id postgres > /dev/null 2>&1; then
32+
su - postgres -c "psql -c 'drop database if exists zabbix_server;'"
33+
fi
3434
SHELL
35-
36-
apply_manifest(cleanup_puppet)
37-
shell(cleanup_script)
3835
end

0 commit comments

Comments
 (0)