kitchen-zcloudjp 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d836cf1f441befe7b4898766426218672ac01001
4
- data.tar.gz: 1688e90f07c4d871c35006460dcf5baab96b1784
3
+ metadata.gz: b1a0334a8af29b86bf5275166ac376a18b03f4f4
4
+ data.tar.gz: 35b9cb9d0da85f6ad823ba07604cf9912a37e899
5
5
  SHA512:
6
- metadata.gz: ed59a558fca70f5af150b041474533484e45f93d3bd525d3c89fc6386014de698f77f1df4a83d6c625fa7158b69a5eb98e1e2d44aa04d4881225ce4bef5303b9
7
- data.tar.gz: 55c20b559456644eb38266692fa7899682ae15ff0a8b32c284bc9956d389bf1a5c8bb64ff13bb60f14e20fdc510a3426718ae44764c0ef949142abd51bbb8a38
6
+ metadata.gz: 81113fc229504165e9a58e6cb1ecc3ee5e4263ffc3c41b1a8ddac5f8707ecdd92f3b5781fe350c88c441976bc3c87e750da7372627cefea923beed90d078e9a1
7
+ data.tar.gz: 43ae5f9524e30a016c95c316cea7f7e0f445257f47eab18e9dc2d25f8d853db49b86ed4c0950eb94efd0da2235bb226141faeaba7498450b1c8ae0ce63ff787e
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  .kitchen.yml
22
22
  foo.json
23
23
  cookbooks/
24
+ .envrc
@@ -1,5 +1,9 @@
1
1
  # Changelog for kitchen-zcloudjp
2
2
 
3
+ ## 0.6.0
4
+
5
+ - update gem test-kitchen to ~> 1.4.0
6
+
3
7
  ## 0.5.0
4
8
 
5
9
  - update gem test-kitchen to ~> 1.2.0
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'test-kitchen', '~> 1.2.0'
21
+ spec.add_dependency 'test-kitchen', '~> 1.4.0'
22
22
  spec.add_dependency 'zcloudjp'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.5'
24
+ spec.add_development_dependency 'bundler', '~> 1.9'
25
25
  spec.add_development_dependency 'rake'
26
26
 
27
27
  spec.add_development_dependency 'cane'
@@ -17,17 +17,17 @@
17
17
  # limitations under the License.
18
18
 
19
19
 
20
+ require 'active_support'
20
21
  require 'zcloudjp'
21
22
 
22
23
  require 'benchmark'
23
24
  require 'kitchen'
24
- require 'kitchen/busser'
25
-
26
25
 
27
26
  module Kitchen
28
-
29
27
  module Driver
30
28
  class Zcloudjp < Kitchen::Driver::SSHBase
29
+ # kitchen_driver_api_version 2
30
+
31
31
  default_config :dataset, 'sdc:sdc:base64:13.4.2' # base64 image
32
32
  default_config :package, 'Small_1GB'
33
33
  default_config :with_gcc, true
@@ -59,7 +59,6 @@ module Kitchen
59
59
  end
60
60
  end
61
61
 
62
-
63
62
  def destroy(state)
64
63
  return if state[:server_id].nil?
65
64
  server = client.machine.show(:id => state[:server_id])
@@ -76,37 +75,42 @@ module Kitchen
76
75
  state.delete(:hostname)
77
76
  end
78
77
 
79
-
80
78
  def converge(state)
81
- provisioner = instance.provisioner
82
- provisioner.create_sandbox
83
- sandbox_dirs = Dir.glob("#{provisioner.sandbox_path}/*")
84
-
85
79
  server = client.machine.show(:id => state[:server_id])
86
80
  info("--> Updating metadata...")
87
81
  server.metadata.update(:metadata => build_metadata)
88
- ssh_args = build_ssh_args(state)
89
-
90
82
  if server.os == "SmartOS"
91
- install_chef_for_smartos(ssh_args)
83
+ overrides_p = instance.provisioner.instance_variable_get(:@config)
84
+ overrides_p[:require_chef_omnibus] = false
85
+ overrides_p[:ohai_version] = config[:ohai_version] ||= "7.0.4"
86
+ overrides_p[:chef_version] = config[:chef_version] ||= "11.4"
87
+ overrides_p[:chef_solo_path] = config[:chef_solo_path] ||= "/opt/local/bin/chef-solo"
88
+ overrides_p[:client_path] = config[:client_path] ||= "/opt/local/bin/chef-client"
89
+ instance.provisioner.instance_variable_set(:@config, overrides_p)
90
+
91
+ ## Install chef to smartos
92
+ instance.transport.connection(backcompat_merged_state(state)) do |conn|
93
+ conn.execute(env_cmd(install_chef_for_smartos))
94
+ end
92
95
  else
93
- fix_monkey_dataset(ssh_args)
94
- # install_omnibus(ssh_args) if config[:require_chef_omnibus]
96
+ instance.transport.connection(backcompat_merged_state(state)) do |conn|
97
+ conn.execute(env_cmd("sudo chmod 01777 /tmp"))
98
+ end
95
99
  end
100
+ super
101
+ end
96
102
 
97
- Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
98
- run_remote(provisioner.install_command, conn)
99
- run_remote(provisioner.init_command, conn)
100
- transfer_path(sandbox_dirs, provisioner[:root_path], conn)
101
- run_remote(provisioner.prepare_command, conn)
102
- puts provisioner[:test_base_path]
103
- puts '-------------'
104
- run_remote(provisioner.run_command, conn)
103
+ def setup(state)
104
+ server = client.machine.show(:id => state[:server_id])
105
+ if server.os == "SmartOS"
106
+ overrides_v = instance.verifier.instance_variable_get(:@config)
107
+ overrides_v[:ruby_bindir] = config[:ruby_bindir] ||= "/opt/local/bin"
108
+ instance.provisioner.instance_variable_set(:@config, overrides_v)
105
109
  end
106
- ensure
107
- provisioner && provisioner.cleanup_sandbox
110
+ super
108
111
  end
109
112
 
113
+ private
110
114
  def client
111
115
  ::Zcloudjp::Client.new(
112
116
  :api_key => config[:api_key]
@@ -132,34 +136,23 @@ module Kitchen
132
136
  end
133
137
  end
134
138
 
135
- def install_chef_for_smartos(ssh_args)
139
+ def install_chef_for_smartos
136
140
  if config[:with_gcc]
137
141
  install_pkgs = "gcc47 gcc47-runtime scmgit-base scmgit-docs gmake ruby193-base ruby193-yajl ruby193-nokogiri ruby193-readline pkg-config"
138
142
  else
139
143
  install_pkgs = "scmgit-base scmgit-docs ruby193-base ruby193-yajl ruby193-nokogiri ruby193-readline"
140
144
  end
141
145
 
142
- ssh(ssh_args, <<-INSTALL.gsub(/^ {10}/, ''))
143
- if [ ! -f /opt/local/bin/chef-client ]; then
144
- pkgin -y install #{install_pkgs}
145
-
146
- ## for smf cookbook
147
- pkgin -y install libxslt
148
-
149
- ## install chef
150
- gem update --system --no-ri --no-rdoc
151
- gem install -f --no-ri --no-rdoc ohai #{config[:ohai_version] ? '--version ' + %Q{'= #{config[:ohai_version]}'} : nil }
152
- gem install -f --no-ri --no-rdoc chef #{config[:chef_version] ? '--version ' + %Q{'= #{config[:chef_version]}'} : nil }
153
- gem install -f --no-ri --no-rdoc rb-readline
154
- fi
155
- INSTALL
156
- end
157
-
158
- def fix_monkey_dataset(ssh_args)
159
- ssh(ssh_args, <<-__PATCH__.gsub(/^ {10}/, ''))
160
- ## set sticky bit for /tmp
161
- chmod 01777 /tmp
162
- __PATCH__
146
+ install_cmd = []
147
+ install_cmd << "if [ ! -f /opt/local/bin/chef-client ]; then"
148
+ install_cmd << " pkgin -y install #{install_pkgs}"
149
+ install_cmd << " pkgin -y install libxslt"
150
+ install_cmd << " gem update --system --no-ri --no-rdoc"
151
+ install_cmd << " gem install -f --no-ri --no-rdoc ohai #{config[:ohai_version] ? %Q{--version "#{config[:ohai_version]}"} : nil }"
152
+ install_cmd << " gem install -f --no-ri --no-rdoc chef #{config[:chef_version] ? %Q{--version "#{config[:chef_version]}"} : nil }"
153
+ install_cmd << " gem install -f --no-ri --no-rdoc rb-readline"
154
+ install_cmd << "fi"
155
+ "sh -c '#{install_cmd.join("\n")}'"
163
156
  end
164
157
 
165
158
  def wait_for_sshd_vm(ssh_args)
@@ -176,29 +169,3 @@ module Kitchen
176
169
  end
177
170
  end
178
171
  end
179
-
180
-
181
- module Kitchen
182
- class Busser
183
- class_eval do
184
- alias :orig_setup_cmd :setup_cmd
185
- def setup_cmd
186
- @setup_cmd ||= if local_suite_files.empty?
187
- nil
188
- else
189
- setup_cmd = []
190
- setup_cmd << busser_setup_env
191
- setup_cmd << "if ! #{sudo}#{config[:ruby_bindir]}/gem list busser -i >/dev/null"
192
- setup_cmd << "then #{sudo}#{config[:ruby_bindir]}/gem install #{gem_install_args}"
193
- setup_cmd << "fi"
194
- setup_cmd << "gem_bindir=`#{config[:ruby_bindir]}/ruby -rrubygems -e \"puts Gem.bindir\"`"
195
- setup_cmd << "#{sudo}${gem_bindir}/busser setup"
196
- setup_cmd << "#{sudo}sed -e 's@sh@bash@' #{config[:busser_bin]} -i"
197
- setup_cmd << "#{sudo}#{config[:busser_bin]} plugin install #{plugins.join(' ')}"
198
-
199
- "bash -c '#{setup_cmd.join('; ')}'"
200
- end
201
- end
202
- end
203
- end
204
- end
@@ -19,6 +19,6 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for Zcloudjp Test Kitchen driver
22
- ZCLOUDJP_VERSION = "0.5.1"
22
+ ZCLOUDJP_VERSION = "0.6.0"
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-zcloudjp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: 1.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: zcloudjp
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.5'
47
+ version: '1.9'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.5'
54
+ version: '1.9'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement