kitchen-salt 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88b37d106829f94550c409e6eebb9c1d745bf7ed
4
- data.tar.gz: d305501da8d91fee412673540ee66f90f995c18e
3
+ metadata.gz: f03994ca6c8646d68c1b86979dfdd41f32a2fa89
4
+ data.tar.gz: a82c4bea05fde368a1e2dd19e290076519a24cf8
5
5
  SHA512:
6
- metadata.gz: 7c68cbaf25d24cd854d022b68cade1cef34dd4d41d7fcd54df36dce4cacb076a168fdc5168259e50267095b3fd39aec56c8d8c426c444bebdfd64a5dec400285
7
- data.tar.gz: a0f348d5b3343bf85d83a1989e08f9b422e5af006d00038bfd942a121603b4d2b8ae4a6ff300c7c6589d1db6e41c180202bae41508a5ac0fc97ee4f411a7f3a7
6
+ metadata.gz: d7804949ec34cb3b6bd138131d515cd9e48727aa0ae09a733d864e22e4326c93bd6840989a7bf7d69320beb774937fa353837c12abede923a033ae90bb574523
7
+ data.tar.gz: d5028e5a136ed489c6b9c002323cd965b99d87c7009c84a8d90e8325a3446b8ab61127db3a290beee832953c86801905f1d23b61dfce88f0bd5b2c51eac5b43f
@@ -8,7 +8,10 @@ def install_dependencies
8
8
  test ! -e "$(dirname $0)/repository-setup.sh" || . "$(dirname $0)/repository-setup.sh"
9
9
 
10
10
  export SALT_ROOT="#{config[:root_path]}/#{config[:salt_file_root]}";
11
+ export SALT_SHARE_DIR='/usr/share/salt-formulas'
12
+
11
13
  mkdir -p "${SALT_ROOT}";
14
+ mkdir -p "${SALT_SHARE_DIR}";
12
15
  INSTALL
13
16
 
14
17
 
@@ -55,34 +58,38 @@ def install_dependencies
55
58
  end
56
59
 
57
60
  # install formulas
58
- config[:dependencies].select{|dependency| dependency.has_key?(:repo)}.each do |formula|
61
+ config[:dependencies].each do |formula|
59
62
  #unless config[:vendor_repo].has_key?(formula[:repo])
60
63
  # raise UserError, "kitchen-salt: Invalid dependency formula :repo, no such vendor_repo '#{formula[:repo]}' specified."
61
64
  #end
62
- case formula[:repo]
63
- when 'git'
64
- script += <<-INSTALL
65
- fetchGitFormula #{formula[:source]} "#{formula[:name]}" "#{formula[:branch] || 'master'}"
66
- INSTALL
67
- when 'spm'
68
- # TODO: SPM should know the sandbox_path is /tmp/kitchen/etc
69
- script += <<-INSTALL
70
- #{sudo('spm')} install #{formula[:package]||formula[:name]};
71
- INSTALL
72
- when 'yum'
73
- script += <<-INSTALL
74
- #{sudo('yum')} install -y #{formula[:package]||formula[:name]};
75
- INSTALL
76
- when 'apt'
77
- script += <<-INSTALL
78
- #{sudo('apt-get')} install -y #{formula[:package]||formula[:name]};
79
- INSTALL
65
+ if formula.key?(:repo)
66
+ case formula[:repo]
67
+ when 'git'
68
+ script += <<-INSTALL
69
+ fetchGitFormula #{formula[:source]} "#{formula[:name]}" "#{formula[:branch] || 'master'}"
70
+ INSTALL
71
+ when 'spm'
72
+ # TODO: SPM should know the sandbox_path is /tmp/kitchen/etc
73
+ script += <<-INSTALL
74
+ #{sudo('spm')} install #{formula[:package]||formula[:name]};
75
+ INSTALL
76
+ when 'yum'
77
+ script += <<-INSTALL
78
+ #{sudo('yum')} install -y #{formula[:package]||formula[:name]};
79
+ INSTALL
80
+ when 'apt'
81
+ script += <<-INSTALL
82
+ #{sudo('apt-get')} install -y #{formula[:package]||formula[:name]};
83
+ INSTALL
84
+ end
85
+ elsif formula.key?(:path)
86
+ prepare_formula formula[:path], formula[:name]
80
87
  end
81
88
  end
82
89
  script += <<-INSTALL
83
90
  linkFormulas "$SALT_ROOT"
84
- #{sudo('chown')} kitchen.kitchen -R /usr/share/salt-formulas;
85
- #{sudo('chown')} kitchen.kitchen -R "$SALT_ROOT";
91
+ #{sudo('chown')} kitchen.kitchen -R "${SALT_SHARE_DIR}";
92
+ #{sudo('chown')} kitchen.kitchen -R "${SALT_ROOT}";
86
93
  ls -la "$SALT_ROOT";
87
94
  INSTALL
88
95
  return script
@@ -13,7 +13,8 @@ sh -c '
13
13
  #{Util.shell_helpers}
14
14
 
15
15
  # what version of salt is installed?
16
- SALT_VERSION=`salt-call --version | cut -d " " -f 2`
16
+ command -v salt-call >/dev/null 2>&1 && SALT_VERSION=$(salt-call --version|cut -d " " -f 2)
17
+ command -v locale-gen >/dev/null 2>&1 && #{sudo('locale-gen')} en_US.UTF-8
17
18
  set +x
18
19
 
19
20
 
@@ -49,10 +50,39 @@ then
49
50
  #{sudo('apt-add-repository')} -y #{salt_ppa}
50
51
  #{sudo('apt-get')} update
51
52
  #{sudo('apt-get')} install -y salt-minion salt-common
53
+ elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "yum" ]
54
+ then
55
+ if [ -z "#{salt_version}" ]
56
+ then
57
+ echo "-----> Installing yum repo for salt latest"
58
+ #{sudo('yum')} install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm
59
+ else
60
+ echo "-----> Installing yum repo for salt #{salt_version}"
61
+ #{sudo('rpm')} --import 'https://repo.saltstack.com/yum/redhat/7/x86_64/archive/#{salt_version}/SALTSTACK-GPG-KEY.pub'
62
+ #{sudo('tee')} /etc/yum.repos.d/saltstack.repo <<EOL
63
+ [saltstack-repo]
64
+ name=SaltStack repo for RHEL/CentOS $releasever
65
+ baseurl=#{Shellwords.escape("https://repo.saltstack.com/yum/redhat/$releasever/$basearch/archive/#{salt_version}")}
66
+ enabled=1
67
+ gpgcheck=1
68
+ gpgkey=#{Shellwords.escape("https://repo.saltstack.com/yum/redhat/$releasever/$basearch/archive/#{salt_version}/SALTSTACK-GPG-KEY.pub")}
69
+ EOL
70
+ fi
71
+ #{sudo('yum')} clean expire-cache
72
+ echo "-----> Installing salt-minion (#{salt_version})"
73
+ #{sudo('yum')} install -y salt-minion salt-common
52
74
  fi
53
75
 
54
76
  # check again, now that an install of some form should have happened
55
- SALT_VERSION=`salt-call --version | cut -d " " -f 2`
77
+ command -v salt-call >/dev/null 2>&1 && SALT_VERSION=$(salt-call --version|cut -d " " -f 2)
78
+
79
+ # extract short format of Salt version
80
+ if [ ! -z "${SALT_VERSION}" ]
81
+ then
82
+ YEAR=$(echo "$SALT_VERSION" | cut -d "." -f1)
83
+ MONTH=$(echo "$SALT_VERSION" | cut -d "." -f2)
84
+ SALT_VERSION="${YEAR}.${MONTH}"
85
+ fi
56
86
 
57
87
  if [ -z "${SALT_VERSION}" ]
58
88
  then
@@ -274,17 +274,21 @@ module Kitchen
274
274
  # PLACEHOLDER, git formulas might be fetched locally to temp and uploaded
275
275
 
276
276
  # setup spm
277
+ spm_template = File.expand_path("./../spm.erb", __FILE__)
278
+ spm_config_content = ERB.new(File.read(spm_template)).result(binding)
279
+ sandbox_spm_config_path = File.join(sandbox_path, config[:salt_config], 'spm')
280
+ write_raw_file(sandbox_spm_config_path, spm_config_content)
281
+
277
282
  spm_repos = config[:vendor_repo].select{|x| x[:type]=='spm'}.each{|x| x[:url]}.map {|x| x[:url] }
278
283
  spm_repos.each do |url|
279
284
  id=url.gsub(/[htp:\/.]/,'')
280
285
  spmreposd = File.join(sandbox_path, 'etc', 'salt', 'spm.repos.d')
281
286
  repo_spec = File.join(spmreposd, 'spm.repo')
282
287
  FileUtils.mkdir_p(spmreposd)
283
- repo_content = '
284
- #{id}:
285
- url: #{url}
286
-
287
- '
288
+ repo_content = "
289
+ #{id}:
290
+ url: #{url}
291
+ "
288
292
  write_raw_file(repo_spec, repo_content)
289
293
  end
290
294
 
@@ -0,0 +1,8 @@
1
+ spm_build_dir: <%= File.join(config[:root_path], (windows_os? ? config[:salt_file_root].gsub('/', '\\') : config[:salt_file_root])) %>/build
2
+ formula_path: <%= File.join(config[:root_path], (windows_os? ? config[:salt_file_root].gsub('/', '\\') : config[:salt_file_root])) %>/formulas
3
+ pillar_path: <%= File.join(config[:root_path], (windows_os? ? config[:salt_pillar_root].gsub('/', '\\') : config[:salt_pillar_root])) %>
4
+ spm_build_exclude:
5
+ - .git
6
+ - .svn
7
+ - .idea
8
+ - .kitchen
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = '0.0.27'.freeze
3
+ VERSION = '0.0.28'.freeze
4
4
  end
5
5
  end
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.27
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon McCartney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-30 00:00:00.000000000 Z
11
+ date: 2017-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -84,7 +84,8 @@ files:
84
84
  - lib/kitchen/provisioner/minion.erb
85
85
  - lib/kitchen/provisioner/repository-setup.sh
86
86
  - lib/kitchen/provisioner/salt_solo.rb
87
- homepage: https://github.com//kitchen-salt
87
+ - lib/kitchen/provisioner/spm.erb
88
+ homepage: https://github.com/saltstack/kitchen-salt
88
89
  licenses:
89
90
  - Apache-2.0
90
91
  metadata: {}
@@ -104,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  version: '0'
105
106
  requirements: []
106
107
  rubyforge_project: "[none]"
107
- rubygems_version: 2.4.3
108
+ rubygems_version: 2.6.12
108
109
  signing_key:
109
110
  specification_version: 4
110
111
  summary: salt provisioner for test-kitchen