kitchen-salt 0.0.28 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen-salt/pillars.rb +19 -0
- data/lib/kitchen-salt/version.rb +1 -1
- data/lib/kitchen/provisioner/dependencies.erb +12 -8
- data/lib/kitchen/provisioner/formula-fetch.sh +2 -2
- data/lib/kitchen/provisioner/install.erb +29 -17
- data/lib/kitchen/provisioner/minion.erb +4 -4
- data/lib/kitchen/provisioner/repository-setup.sh +1 -1
- data/lib/kitchen/provisioner/salt_solo.rb +10 -5
- data/lib/kitchen/provisioner/spm.erb +4 -3
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e051d229d33983d4f1ff8d7f4f092a5e5808af
|
4
|
+
data.tar.gz: 3fc7174b04e097267d2fa49854f51abe5f0d3d45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77590fa2bbc1f1fe17f1a2b1f1f20de2fbe86df9bb5c4e321a8a4d9e91bc9bc6bbd978e5e9f74fb6592286026325fb62acbbf6034fe4c96650635828ea90a8a0
|
7
|
+
data.tar.gz: 9ab055a9ac8a3dee16f1f5adbce36279035196f9516e0f01489b357c3ce7e92c4472c9a10474b5cbe653e7a9593d2f13eb472570909d21c9df0116a8cdbc08a3
|
data/lib/kitchen-salt/pillars.rb
CHANGED
@@ -8,6 +8,25 @@ module Kitchen
|
|
8
8
|
|
9
9
|
pillars = config[:pillars]
|
10
10
|
pillars_from_files = config[:'pillars-from-files']
|
11
|
+
pillars_from_directories = config[:pillars_from_directories]
|
12
|
+
|
13
|
+
debug("Pillars Directories: #{pillars_from_directories}")
|
14
|
+
|
15
|
+
if pillars_from_directories.any?
|
16
|
+
pillars_from_directories.each do |dir|
|
17
|
+
if dir.is_a?(Hash)
|
18
|
+
local_pillar_path = File.expand_path(dir[:source])
|
19
|
+
sandbox_pillar_path = File.join(sandbox_path, dir[:dest])
|
20
|
+
info("Copying pillars from #{dir[:source]} to #{dir[:dest]}")
|
21
|
+
else
|
22
|
+
local_pillar_path = File.expand_path(dir)
|
23
|
+
sandbox_pillar_path = File.join(sandbox_path, '/srv/pillar')
|
24
|
+
info("Copying pillars from #{dir} to /srv/pillar")
|
25
|
+
end
|
26
|
+
cp_r_with_filter(local_pillar_path, sandbox_pillar_path, config[:salt_copy_filter])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
11
30
|
debug("Pillars Hash: #{pillars}")
|
12
31
|
|
13
32
|
if pillars.nil? && pillars_from_files.nil?
|
data/lib/kitchen-salt/version.rb
CHANGED
@@ -59,9 +59,6 @@ def install_dependencies
|
|
59
59
|
|
60
60
|
# install formulas
|
61
61
|
config[:dependencies].each do |formula|
|
62
|
-
#unless config[:vendor_repo].has_key?(formula[:repo])
|
63
|
-
# raise UserError, "kitchen-salt: Invalid dependency formula :repo, no such vendor_repo '#{formula[:repo]}' specified."
|
64
|
-
#end
|
65
62
|
if formula.key?(:repo)
|
66
63
|
case formula[:repo]
|
67
64
|
when 'git'
|
@@ -69,10 +66,16 @@ def install_dependencies
|
|
69
66
|
fetchGitFormula #{formula[:source]} "#{formula[:name]}" "#{formula[:branch] || 'master'}"
|
70
67
|
INSTALL
|
71
68
|
when 'spm'
|
72
|
-
|
73
|
-
|
74
|
-
#{sudo('spm')}
|
75
|
-
|
69
|
+
if formula[:package].nil?
|
70
|
+
script += <<-INSTALL
|
71
|
+
#{sudo('spm')} -c #{config[:root_path]}/etc/salt install -y #{formula[:name]};
|
72
|
+
INSTALL
|
73
|
+
else
|
74
|
+
script += <<-INSTALL
|
75
|
+
#{sudo('curl')} -O #{formula[:package]};
|
76
|
+
#{sudo('spm')} -c #{config[:root_path]}/etc/salt local install -y "$(basename #{formula[:package]})";
|
77
|
+
INSTALL
|
78
|
+
end
|
76
79
|
when 'yum'
|
77
80
|
script += <<-INSTALL
|
78
81
|
#{sudo('yum')} install -y #{formula[:package]||formula[:name]};
|
@@ -90,6 +93,7 @@ def install_dependencies
|
|
90
93
|
linkFormulas "$SALT_ROOT"
|
91
94
|
#{sudo('chown')} kitchen.kitchen -R "${SALT_SHARE_DIR}";
|
92
95
|
#{sudo('chown')} kitchen.kitchen -R "${SALT_ROOT}";
|
96
|
+
echo "Content of $SALT_ROOT :";
|
93
97
|
ls -la "$SALT_ROOT";
|
94
98
|
INSTALL
|
95
99
|
return script
|
@@ -97,7 +101,7 @@ end
|
|
97
101
|
|
98
102
|
|
99
103
|
<<-INSTALL
|
100
|
-
#!/bin/bash
|
104
|
+
#!/usr/bin/env bash
|
101
105
|
|
102
106
|
echo "Install External Dependencies";
|
103
107
|
#{install_dependencies}
|
@@ -78,14 +78,14 @@ function linkFormulas() {
|
|
78
78
|
fi
|
79
79
|
|
80
80
|
# form pkgs
|
81
|
-
find "$SALT_ENV" -maxdepth 1 -mindepth 1 -path "*_formulas*" -prune -o -name "*" -type d -print0| xargs -I{} -0 -n1
|
81
|
+
find "$SALT_ENV" -maxdepth 1 -mindepth 1 -path "*_formulas*" -prune -o -name "*" -type d -print0| xargs -I{} -0 -n1 --no-run-if-empty basename {} | xargs -I{} --no-run-if-empty \
|
82
82
|
ln -fs "$SALT_ENV"/{} "$SALT_ROOT"/{};
|
83
83
|
fi
|
84
84
|
|
85
85
|
}
|
86
86
|
|
87
87
|
# detect if file is being sourced
|
88
|
-
[[ "$0" != "${BASH_SOURCE[
|
88
|
+
[[ "$0" != "${BASH_SOURCE[0]}" ]] || {
|
89
89
|
# if executed, run implicit function
|
90
90
|
fetchGitFormula "${@}"
|
91
91
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
<%=
|
3
2
|
salt_install = config[:salt_install]
|
4
3
|
salt_url = config[:salt_bootstrap_url]
|
@@ -7,6 +6,10 @@ salt_version = config[:salt_version]
|
|
7
6
|
salt_apt_repo = config[:salt_apt_repo]
|
8
7
|
salt_apt_repo_key = config[:salt_apt_repo_key]
|
9
8
|
salt_ppa = config[:salt_ppa]
|
9
|
+
salt_yum_rpm_key = config[:salt_yum_rpm_key] % [salt_version]
|
10
|
+
salt_yum_repo = config[:salt_yum_repo] % [salt_version]
|
11
|
+
salt_yum_repo_key = config[:salt_yum_repo_key] % [salt_version]
|
12
|
+
salt_yum_repo_latest = config[:salt_yum_repo_latest]
|
10
13
|
|
11
14
|
<<-INSTALL
|
12
15
|
sh -c '
|
@@ -30,6 +33,10 @@ then
|
|
30
33
|
DISTRIB_CODENAME=$(lsb_release -s -c)
|
31
34
|
fi
|
32
35
|
|
36
|
+
echo "-----> Install apt-transport-https"
|
37
|
+
#{sudo('apt-get')} update
|
38
|
+
#{sudo('apt-get')} install -y apt-transport-https gnupg
|
39
|
+
|
33
40
|
echo "-----> Configuring apt repo for salt #{salt_version}"
|
34
41
|
echo "deb #{salt_apt_repo}/#{salt_version} ${DISTRIB_CODENAME} main" | #{sudo('tee')} /etc/apt/sources.list.d/salt-#{salt_version}.list
|
35
42
|
|
@@ -40,47 +47,49 @@ then
|
|
40
47
|
sleep 10
|
41
48
|
echo "-----> Installing salt-minion (#{salt_version})"
|
42
49
|
#{sudo('apt-get')} install -y python-support
|
43
|
-
#{sudo('apt-get')} install -y salt-minion salt-common
|
50
|
+
#{sudo('apt-get')} install -y salt-minion salt-common salt-master
|
44
51
|
elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "distrib" ]
|
45
52
|
then
|
46
53
|
#{sudo('apt-get')} update
|
47
|
-
#{sudo('apt-get')} install -y
|
54
|
+
#{sudo('apt-get')} install -y python-support
|
55
|
+
#{sudo('apt-get')} install -y salt-minion salt-master
|
48
56
|
elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "ppa" ]
|
49
57
|
then
|
50
58
|
#{sudo('apt-add-repository')} -y #{salt_ppa}
|
51
59
|
#{sudo('apt-get')} update
|
52
|
-
#{sudo('apt-get')} install -y
|
60
|
+
#{sudo('apt-get')} install -y python-support
|
61
|
+
#{sudo('apt-get')} install -y salt-minion salt-common salt-master
|
53
62
|
elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "yum" ]
|
54
63
|
then
|
55
64
|
if [ -z "#{salt_version}" ]
|
56
65
|
then
|
57
66
|
echo "-----> Installing yum repo for salt latest"
|
58
|
-
#{sudo('yum')} install
|
67
|
+
#{sudo('yum')} install #{salt_yum_repo_latest}
|
59
68
|
else
|
60
69
|
echo "-----> Installing yum repo for salt #{salt_version}"
|
61
|
-
#{sudo('rpm')} --import '
|
70
|
+
#{sudo('rpm')} --import '#{salt_yum_rpm_key}'
|
62
71
|
#{sudo('tee')} /etc/yum.repos.d/saltstack.repo <<EOL
|
63
72
|
[saltstack-repo]
|
64
73
|
name=SaltStack repo for RHEL/CentOS $releasever
|
65
|
-
baseurl=#{Shellwords.escape(
|
74
|
+
baseurl=#{Shellwords.escape(salt_yum_repo)}
|
66
75
|
enabled=1
|
67
76
|
gpgcheck=1
|
68
|
-
gpgkey=#{Shellwords.escape(
|
77
|
+
gpgkey=#{Shellwords.escape(salt_yum_repo_key)}
|
69
78
|
EOL
|
70
79
|
fi
|
71
80
|
#{sudo('yum')} clean expire-cache
|
72
81
|
echo "-----> Installing salt-minion (#{salt_version})"
|
73
|
-
#{sudo('yum')} install -y salt-minion salt-common
|
82
|
+
#{sudo('yum')} install -y salt-minion salt-common salt-master
|
74
83
|
fi
|
75
84
|
|
76
85
|
# check again, now that an install of some form should have happened
|
77
|
-
command -v salt-call >/dev/null 2>&1 &&
|
86
|
+
command -v salt-call >/dev/null 2>&1 && FULL_SALT_VERSION=$(salt-call --version|cut -d " " -f 2)
|
78
87
|
|
79
88
|
# extract short format of Salt version
|
80
|
-
if [ ! -z "${
|
89
|
+
if [ ! -z "${FULL_SALT_VERSION}" ]
|
81
90
|
then
|
82
|
-
YEAR=$(echo "$
|
83
|
-
MONTH=$(echo "$
|
91
|
+
YEAR=$(echo "$FULL_SALT_VERSION" | cut -d "." -f1)
|
92
|
+
MONTH=$(echo "$FULL_SALT_VERSION" | cut -d "." -f2)
|
84
93
|
SALT_VERSION="${YEAR}.${MONTH}"
|
85
94
|
fi
|
86
95
|
|
@@ -94,10 +103,14 @@ then
|
|
94
103
|
echo "salt_apt_repo = #{salt_apt_repo}"
|
95
104
|
echo "salt_apt_repo_key = #{salt_apt_repo_key}"
|
96
105
|
echo "salt_ppa = #{salt_ppa}"
|
106
|
+
echo "salt_yum_rpm_key = #{salt_yum_rpm_key}"
|
107
|
+
echo "salt_yum_repo = #{salt_yum_repo}"
|
108
|
+
echo "salt_yum_repo_key = #{salt_yum_repo_key}"
|
109
|
+
echo "salt_yum_repo_latest = #{salt_yum_repo_latest}"
|
97
110
|
exit 2
|
98
|
-
elif [ "${SALT_VERSION}" = "#{salt_version}" -o "#{salt_version}" = "latest" ]
|
111
|
+
elif [ "${SALT_VERSION}" = "#{salt_version}" -o "#{salt_version}" = "latest" -o "#{salt_version}" = "${FULL_SALT_VERSION}" ]
|
99
112
|
then
|
100
|
-
echo "You asked for #{salt_version} and you have ${
|
113
|
+
echo "You asked for #{salt_version} and you have ${FULL_SALT_VERSION} installed, sweet!"
|
101
114
|
elif [ ! -z "${SALT_VERSION}" -a "#{salt_install}" = "bootstrap" ]
|
102
115
|
then
|
103
116
|
echo "You asked for bootstrap install and you have got ${SALT_VERSION}, hope thats ok!"
|
@@ -106,7 +119,6 @@ else
|
|
106
119
|
exit 2
|
107
120
|
fi
|
108
121
|
|
109
|
-
#{install_chef}
|
110
|
-
'
|
122
|
+
#{install_chef}'
|
111
123
|
INSTALL
|
112
124
|
%>
|
@@ -1,13 +1,13 @@
|
|
1
|
+
local: true
|
1
2
|
state_top: top.sls
|
2
|
-
|
3
|
-
file_client: local
|
3
|
+
root_dir: <%= config[:root_path] %>
|
4
4
|
|
5
5
|
file_roots:
|
6
6
|
<%= config[:salt_env] %>:
|
7
|
-
|
8
7
|
- <%= File.join(config[:root_path], (windows_os? ? config[:salt_file_root].gsub('/', '\\') : config[:salt_file_root])) %>
|
9
|
-
- <%= File.join(config[:root_path], (windows_os? ? config[:
|
8
|
+
- <%= File.join(config[:root_path], (windows_os? ? config[:salt_spm_root].gsub('/', '\\') : config[:salt_spm_root])) %>/salt
|
10
9
|
|
11
10
|
pillar_roots:
|
12
11
|
<%= config[:salt_env] %>:
|
13
12
|
- <%= File.join(config[:root_path], (windows_os? ? config[:salt_pillar_root].gsub('/', '\\') : config[:salt_pillar_root])) %>
|
13
|
+
- <%= File.join(config[:root_path], (windows_os? ? config[:salt_spm_root].gsub('/', '\\') : config[:salt_spm_root])) %>/pillar
|
@@ -18,7 +18,7 @@ function apt_repo_add {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
# detect if file is being sourced
|
21
|
-
[[ "$0" != "${BASH_SOURCE[
|
21
|
+
[[ "$0" != "${BASH_SOURCE[0]}" ]] || {
|
22
22
|
# if executed, run implicit function
|
23
23
|
#apt_repo_add "${@}"
|
24
24
|
echo 'Usage: apt_repo_add "custom id" "arch" "repo url" "components" "distribution" "repo gpg key"';
|
@@ -40,7 +40,7 @@ module Kitchen
|
|
40
40
|
salt_install: 'bootstrap',
|
41
41
|
salt_bootstrap_url: 'https://bootstrap.saltstack.com',
|
42
42
|
salt_bootstrap_options: '',
|
43
|
-
salt_apt_repo: 'https://repo.saltstack.com/apt/ubuntu/16.04/amd64/
|
43
|
+
salt_apt_repo: 'https://repo.saltstack.com/apt/ubuntu/16.04/amd64/',
|
44
44
|
salt_apt_repo_key: 'https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub',
|
45
45
|
salt_ppa: 'ppa:saltstack/salt',
|
46
46
|
bootstrap_url: 'https://raw.githubusercontent.com/saltstack/kitchen-salt/master/assets/install.sh',
|
@@ -65,7 +65,12 @@ module Kitchen
|
|
65
65
|
vendor_path: nil,
|
66
66
|
vendor_repo: {},
|
67
67
|
omnibus_cachier: false,
|
68
|
-
local_salt_root: nil
|
68
|
+
local_salt_root: nil,
|
69
|
+
pillars_from_directories: [],
|
70
|
+
salt_yum_rpm_key: 'https://repo.saltstack.com/yum/redhat/7/x86_64/archive/%s/SALTSTACK-GPG-KEY.pub',
|
71
|
+
salt_yum_repo: 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/archive/%s',
|
72
|
+
salt_yum_repo_key: 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/archive/%s/SALTSTACK-GPG-KEY.pub',
|
73
|
+
salt_yum_repo_latest: 'https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm'
|
69
74
|
}
|
70
75
|
|
71
76
|
# salt-call version that supports the undocumented --retcode-passthrough command
|
@@ -102,12 +107,12 @@ module Kitchen
|
|
102
107
|
chef_url = config[:chef_bootstrap_url]
|
103
108
|
if windows_os?
|
104
109
|
<<-POWERSHELL
|
105
|
-
if (-Not $(test-path c:\\opscode\\chef) {
|
110
|
+
if (-Not $(test-path c:\\opscode\\chef) {
|
106
111
|
if (-Not $(Test-Path c:\\temp)) {
|
107
112
|
New-Item -Path c:\\temp -itemtype directory
|
108
113
|
}
|
109
114
|
(New-Object net.webclient).DownloadFile("#{chef_url}", "c:\\temp\\chef_bootstrap.ps1")
|
110
|
-
write-host "-----> Installing Chef Omnibus (for busser/serverspec ruby support)"
|
115
|
+
write-host "-----> Installing Chef Omnibus (for busser/serverspec ruby support)"
|
111
116
|
#{sudo('powershell')} c:\\temp\\chef_bootstrap.ps1
|
112
117
|
}
|
113
118
|
POWERSHELL
|
@@ -152,7 +157,7 @@ module Kitchen
|
|
152
157
|
def init_command
|
153
158
|
debug("Initialising Driver #{name}")
|
154
159
|
if windows_os?
|
155
|
-
cmd = "mkdir -Force -Path ""#{config[:root_path]}"""
|
160
|
+
cmd = "mkdir -Force -Path ""#{config[:root_path]}""\n"
|
156
161
|
else
|
157
162
|
cmd = "mkdir -p '#{config[:root_path]}';"
|
158
163
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
-
spm_build_dir: <%= File.join(config[:root_path]
|
2
|
-
formula_path: <%= File.join(config[:root_path], (windows_os? ? config[:
|
3
|
-
pillar_path: <%= File.join(config[:root_path], (windows_os? ? config[:
|
1
|
+
spm_build_dir: <%= File.join(config[:root_path]) %>/build
|
2
|
+
formula_path: <%= File.join(config[:root_path], (windows_os? ? config[:salt_spm_root].gsub('/', '\\') : config[:salt_spm_root])) %>/salt
|
3
|
+
pillar_path: <%= File.join(config[:root_path], (windows_os? ? config[:salt_spm_root].gsub('/', '\\') : config[:salt_spm_root])) %>/pillar
|
4
|
+
root_dir: <%= config[:root_path] %>
|
4
5
|
spm_build_exclude:
|
5
6
|
- .git
|
6
7
|
- .svn
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- SaltStack Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.2'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.2'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pry
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,7 +54,7 @@ dependencies:
|
|
68
54
|
version: 0.7.3
|
69
55
|
description: salt provisioner for test-kitchen so that you can test all the things
|
70
56
|
email:
|
71
|
-
-
|
57
|
+
- daniel@gtmanfred.com
|
72
58
|
executables: []
|
73
59
|
extensions: []
|
74
60
|
extra_rdoc_files: []
|
@@ -105,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
91
|
version: '0'
|
106
92
|
requirements: []
|
107
93
|
rubyforge_project: "[none]"
|
108
|
-
rubygems_version: 2.6.
|
94
|
+
rubygems_version: 2.6.13
|
109
95
|
signing_key:
|
110
96
|
specification_version: 4
|
111
97
|
summary: salt provisioner for test-kitchen
|