kitchen-salt 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -28,10 +28,17 @@ module Kitchen
28
28
  # @author Chris Lundquist (<chris.ludnquist@github.com>)
29
29
  class SaltSolo < Base
30
30
 
31
- default_config :salt_bootstrap, true
31
+ # supported install methods: bootstrap|apt
32
+ default_config :salt_install, "bootstrap"
33
+
32
34
  default_config :salt_bootstrap_url, "http://bootstrap.saltstack.org"
33
35
  default_config :salt_bootstrap_options, ""
34
36
 
37
+ # alternative method of installing salt
38
+ default_config :salt_version, "0.16.2"
39
+ default_config :salt_apt_repo, "http://apt.mccartney.ie"
40
+ default_config :salt_apt_repo_key, "http://apt.mccartney.ie/KEY"
41
+
35
42
  default_config :chef_bootstrap_url, "https://www.getchef.com/chef/install.sh"
36
43
 
37
44
  default_config :salt_config, "/etc/salt"
@@ -44,22 +51,50 @@ module Kitchen
44
51
  default_config :salt_run_highstate, true
45
52
 
46
53
  def install_command
47
- return unless config[:salt_bootstrap]
54
+ debug(diagnose())
55
+ salt_install = config[:salt_install]
48
56
 
49
57
  salt_url = config[:salt_bootstrap_url]
50
58
  chef_url = config[:chef_bootstrap_url]
51
59
  bootstrap_options = config[:salt_bootstrap_options]
52
60
 
61
+ salt_version = config[:salt_version]
62
+ salt_apt_repo = config[:salt_apt_repo]
63
+ salt_apt_repo_key = config[:salt_apt_repo_key]
64
+
53
65
  <<-INSTALL
54
66
  sh -c '
55
67
  #{Util.shell_helpers}
56
68
 
57
- # install salt, if not already installed
58
- SALT_CALL=`which salt-call`
59
- if [ -z "${SALT_CALL}" ]
69
+ # what version of salt is installed?
70
+ SALT_VERSION=`salt-call --version | cut -d " " -f 2`
71
+
72
+
73
+ if [ -z "${SALT_VERSION}" -a "#{salt_install}" = "bootstrap" ]
60
74
  then
61
75
  do_download #{salt_url} /tmp/bootstrap-salt.sh
62
76
  #{sudo('sh')} /tmp/bootstrap-salt.sh #{bootstrap_options}
77
+ elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "apt" ]
78
+ then
79
+ . /etc/lsb-release
80
+
81
+ echo "deb #{salt_apt_repo}/salt-#{salt_version} ${DISTRIB_CODENAME} main" | #{sudo('tee')} /etc/apt/sources.list.d/salt-#{salt_version}.list
82
+
83
+ do_download #{salt_apt_repo_key} /tmp/repo.key
84
+ #{sudo('apt-key')} add /tmp/repo.key
85
+
86
+ #{sudo('apt-get')} update
87
+ #{sudo('apt-get')} install -y salt-minion
88
+ elif [ -z "${SALT_VERSION}" ]
89
+ then
90
+ echo "No salt-minion installed and I do not know how to install one!"
91
+ exit 2
92
+ elif [ "${SALT_VERSION}" = "#{salt_version}" ]
93
+ then
94
+ echo "You asked for #{salt_version} and you have already got ${SALT_VERSION} installed, sweet!"
95
+ else
96
+ echo "You asked for #{salt_version} and you have got ${SALT_VERSION} installed, dunno how to fix that, sorry!"
97
+ exit 2
63
98
  fi
64
99
 
65
100
  # install chef omnibus so that busser works :(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-15 00:00:00.000000000 Z
12
+ date: 2014-01-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: salt provisioner for test-kitchen
15
15
  email: