kondate 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +27 -5
- data/lib/kondate/cli.rb +4 -1
- data/lib/kondate/property_builder.rb +0 -4
- data/lib/kondate/templates/hosts.yml +0 -1
- data/lib/kondate/templates/spec/spec_helper.rb +1 -1
- data/lib/kondate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 872d487f03a83e112bc7025bd7cf90a4d4f5f457
|
4
|
+
data.tar.gz: 35fc66dbe8261daf3cca13463dcb5594e4ea8711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f4e2f7ec928b35574819abf608cacb6627aa0db7aada34db129889e7c9e86c17c82cf955fffa52319fb6d8fe3177d078414ddf1b0703cecba3330f32be6695
|
7
|
+
data.tar.gz: 4af4298871810ab4c02f5ac423c1b097fd4f5e53bf6b5ec096af07c4af536a1e036470aaa5b1bc303146bf8a29ea189eb5e062bbb41ceaf7131984e555702e5a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -236,7 +236,23 @@ set :host, ENV['TARGET_HOST']
|
|
236
236
|
set :set_property, YAML.load_file(ENV['TARGET_NODE_FILE'])
|
237
237
|
```
|
238
238
|
|
239
|
-
because these ENVs are passed by `kondate serverspec`.
|
239
|
+
because these ENVs are passed by `kondate serverspec`.
|
240
|
+
|
241
|
+
Configuring following lines for vagrant is also recommended:
|
242
|
+
|
243
|
+
```
|
244
|
+
if ENV['TARGET_VAGRANT']
|
245
|
+
`vagrant up #{host}`
|
246
|
+
|
247
|
+
config = Tempfile.new('', Dir.tmpdir)
|
248
|
+
config.write(`vagrant ssh-config #{host}`)
|
249
|
+
config.close
|
250
|
+
|
251
|
+
Net::SSH::Config.for(host, [config.path])
|
252
|
+
else
|
253
|
+
```
|
254
|
+
|
255
|
+
`ENV['TARGET_VAGRANT']` is turned on if `kondate serverspec` is executed with `--vagrant` option.
|
240
256
|
|
241
257
|
See [templates/spec/spec_helper.rb](./lib/kondate/templates/spec/spec_helper.rb) for an example.
|
242
258
|
|
@@ -246,16 +262,22 @@ The default reads `hosts.yml` to resolve roles of a host, but
|
|
246
262
|
you may want to resolve roles from AWS EC2 `roles` tag, or
|
247
263
|
you may want to resolve roles from your own host resolver API application.
|
248
264
|
|
249
|
-
Thus, `kondate` provides a plugin system to
|
265
|
+
Thus, `kondate` provides a plugin system to resolve hosts' roles.
|
250
266
|
|
251
267
|
### Naming Convention
|
252
268
|
|
253
269
|
You must follow the below naming conventions:
|
254
270
|
|
255
|
-
* gem name: kondate-host_plugin-xxx (xxx_yyy)
|
271
|
+
* gem name: kondate-host_plugin-xxx (xxx_yyy) (if you want to make a gem)
|
256
272
|
* file name: lib/kondate/host_plugin/xxx.rb (xxx_yyy.rb)
|
257
273
|
* class name: Kondate::HostPlugin::Xxx (XxxYyy)
|
258
274
|
|
275
|
+
If you want to put your own host plugin locally without publishing a gem, you can configure the location with .kondate.conf as:
|
276
|
+
|
277
|
+
```
|
278
|
+
plugin_dir: lib
|
279
|
+
```
|
280
|
+
|
259
281
|
### Interface
|
260
282
|
|
261
283
|
What you have to implement are `#initialize`, `#get_environment`, and `#get_roles` methods. Here is an example of file plugin:
|
@@ -313,8 +335,8 @@ vagrant up
|
|
313
335
|
```
|
314
336
|
|
315
337
|
```
|
316
|
-
bundle exec exe/kondate itamae vagrant-centos --role sample
|
317
|
-
bundle exec exe/kondate serverspec vagrant-centos --role sample
|
338
|
+
bundle exec exe/kondate itamae vagrant-centos --vagrant --role sample
|
339
|
+
bundle exec exe/kondate serverspec vagrant-centos --vagrant --role sample
|
318
340
|
```
|
319
341
|
|
320
342
|
## ToDo
|
data/lib/kondate/cli.rb
CHANGED
@@ -51,6 +51,7 @@ module Kondate
|
|
51
51
|
option :recipe, :type => :array, :default => []
|
52
52
|
option :debug, :aliases => ["-d"], :type => :boolean, :default => false
|
53
53
|
option :confirm, :type => :boolean, :default => true
|
54
|
+
option :vagrant, :type => :boolean, :default => false
|
54
55
|
def itamae(host)
|
55
56
|
builder, property_files = build_property_files(host)
|
56
57
|
|
@@ -62,7 +63,7 @@ module Kondate
|
|
62
63
|
|
63
64
|
properties = YAML.load_file(property_file)
|
64
65
|
|
65
|
-
if
|
66
|
+
if @options[:vagrant]
|
66
67
|
command << " --vagrant"
|
67
68
|
else
|
68
69
|
config = Net::SSH::Config.for(host)
|
@@ -85,10 +86,12 @@ module Kondate
|
|
85
86
|
option :recipe, :type => :array, :default => []
|
86
87
|
option :debug, :aliases => ["-d"], :type => :boolean, :default => false
|
87
88
|
option :confirm, :type => :boolean, :default => true
|
89
|
+
option :vagrant, :type => :boolean, :default => false
|
88
90
|
def serverspec(host)
|
89
91
|
builder, property_files = build_property_files(host)
|
90
92
|
|
91
93
|
ENV['RUBYOPT'] = "-I #{Config.plugin_dir} -r bundler/setup -r ext/serverspec/kondate"
|
94
|
+
ENV['TARGET_VAGRANT'] = '1' if @options[:vagrant]
|
92
95
|
property_files.each do |role, property_file|
|
93
96
|
RSpec::Core::RakeTask.new([host, role].join(':'), :recipe) do |t, args|
|
94
97
|
ENV['TARGET_HOST'] = host
|
data/lib/kondate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kondate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sonots
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: itamae
|