kitchen-itamae 0.1.1 → 0.2.0

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: c7e3e1aa4c7ba1ee5928e94eede7f4c370adf0e6
4
- data.tar.gz: 399f22d96967edf51efdd81f4d589481dd202421
3
+ metadata.gz: 59dec5d7ae3c30539b9bb71086ce2eb8059f053f
4
+ data.tar.gz: b7279dc56d493105d640166023c837de4fbb457b
5
5
  SHA512:
6
- metadata.gz: 4740ab9c5802e1de67fee3c9019fd58868a5d41ab4483833c386eedf19893bc94e21b0f3ed51b8ad184c9ad91d8e0285ee188af06e99bdd6102fcc4dc24f0935
7
- data.tar.gz: b4f0bf64645253e3205ebe6ff44eda9751a58d449a4f1947aa4c510c500b5e98dcf3d2789807328930bcd87569981f81695777f6890f442b4f599c675acf6341
6
+ metadata.gz: 37bda91c8d41082c5f8b307b4d1dd203f9f2d7826e003d218aaa6e186932d21b5d9ae505b1d7eb4bb5823ced62ab627f1abadbd06551891a325f4c15660169ab
7
+ data.tar.gz: 6b7b3a5c4406628f0befb4af2bdc82a4327626aede201645060dd992aaad98fb4b5598b79370d3fbfaa0d9d89b78d5dcfc59164c0a783d0da934d11b8928bcab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  CHANGELOG of Itamae::Kitchen
2
2
 
3
+ ## 0.2.0
4
+
5
+ - Feature: support attributes.
6
+ - attributes will merge with node_json.
7
+
3
8
  ## 0.1.1
4
9
 
5
10
  - Plugin shoud work under bundler.
@@ -19,6 +19,7 @@ module Kitchen
19
19
  expand_path_for :itamae_root
20
20
 
21
21
  default_config :node_json, nil
22
+ default_config :attributes, {}
22
23
  default_config :with_ohai, false
23
24
  default_config :itamae_option, nil
24
25
  default_config :use_bundler do |provisioner|
@@ -29,6 +30,7 @@ module Kitchen
29
30
  # (see Base#create_sandbox)
30
31
  def create_sandbox
31
32
  super
33
+ prepare_json
32
34
  FileUtils.cp_r(Dir.glob("#{config[:itamae_root]}/*"), sandbox_path)
33
35
  end
34
36
 
@@ -65,7 +67,7 @@ module Kitchen
65
67
  cmd << 'local'
66
68
  cmd << '--ohai' if config[:with_ohai]
67
69
  cmd << config[:itamae_option]
68
- cmd << "-j #{config[:node_json]}" if config[:node_json]
70
+ cmd << "-j dna.json"
69
71
  cmd << recipe
70
72
  cmd.join(" ")
71
73
  end
@@ -83,7 +85,6 @@ module Kitchen
83
85
 
84
86
  private
85
87
  # (see ChefBase private)
86
-
87
88
  def download_helpers
88
89
  IO.read(
89
90
  Gem.find_files_from_load_path('../support/download_helpers.sh').first
@@ -127,6 +128,20 @@ EOL
127
128
  #{sudo("sh")} /tmp/install_itamae.sh
128
129
  INSTALL_ITAMAE
129
130
  end
131
+
132
+ # (see ChefBase#prepare_json)
133
+ def prepare_json
134
+ dna = {}
135
+ dna.merge!(JSON.parse(File.read(File.join(config[:itamae_root], config[:node_json])))) if config[:node_json]
136
+ dna.rmerge!(config[:attributes])
137
+
138
+ info("Preparing dna.json")
139
+ debug("Creating dna.json from #{dna.inspect}")
140
+
141
+ File.open(File.join(sandbox_path, "dna.json"), "wb") do |file|
142
+ file.write(dna.to_json)
143
+ end
144
+ end
130
145
  end
131
146
  end
132
147
  end
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Itamae
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.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-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen