ey_enzyme 0.9.45.ruby19.1 → 0.9.48
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_enzyme.rb +0 -2
- data/lib/ey_enzyme/api.rb +1 -0
- data/lib/ey_enzyme/cli.rb +30 -13
- data/lib/ey_enzyme/cookbook_set.rb +5 -1
- data/lib/ey_enzyme/version.rb +1 -1
- metadata +16 -56
data/lib/ey_enzyme.rb
CHANGED
data/lib/ey_enzyme/api.rb
CHANGED
@@ -38,6 +38,7 @@ module EY::Enzyme
|
|
38
38
|
|
39
39
|
#upload, as in, upload the log file output of the chef run
|
40
40
|
def upload(type, content)
|
41
|
+
content = content.force_encoding('UTF-8') if content.respond_to?(:force_encoding)
|
41
42
|
retry_api("store", :type => type, :content => content)
|
42
43
|
rescue => e
|
43
44
|
#blanket rescue feels dangerous, but we're at least logging it
|
data/lib/ey_enzyme/cli.rb
CHANGED
@@ -104,14 +104,14 @@ module EY::Enzyme
|
|
104
104
|
def deploy
|
105
105
|
@logger.info "Starting configuration run"
|
106
106
|
|
107
|
-
update_dna
|
107
|
+
json = update_dna
|
108
108
|
|
109
109
|
case @opts[:type]
|
110
110
|
when :main
|
111
111
|
run_main
|
112
|
-
run_custom
|
112
|
+
run_custom(json)
|
113
113
|
when :custom
|
114
|
-
run_custom
|
114
|
+
run_custom(json)
|
115
115
|
else
|
116
116
|
raise "Unknown type: #{@opts[:type].inspect}"
|
117
117
|
end
|
@@ -124,20 +124,20 @@ module EY::Enzyme
|
|
124
124
|
main_cookbooks.run
|
125
125
|
end
|
126
126
|
|
127
|
-
def run_custom
|
127
|
+
def run_custom(json)
|
128
128
|
report 'running custom recipes if they exist'
|
129
|
-
|
129
|
+
url = @opts.has_key?(:custom_recipes_url) ? @opts[:custom_recipes_url] : @api.custom_recipe_url
|
130
|
+
update_custom_dna(json) if url
|
131
|
+
|
132
|
+
@custom_cookbooks ||= CookbookSet.new(@opts, "custom", CUSTOM_RECIPE_PATH, url, @api)
|
133
|
+
|
134
|
+
@custom_cookbooks.run
|
130
135
|
end
|
131
136
|
|
132
137
|
def main_cookbooks
|
133
138
|
@main_cookbooks ||= CookbookSet.new(@opts, "main", MAIN_RECIPE_PATH, @opts[:recipes_url], @api)
|
134
139
|
end
|
135
140
|
|
136
|
-
def custom_cookbooks
|
137
|
-
url = @opts.has_key?(:custom_recipes_url) ? @opts[:custom_recipes_url] : @api.custom_recipe_url
|
138
|
-
@custom_cookbooks ||= CookbookSet.new(@opts, "custom", CUSTOM_RECIPE_PATH, url, @api)
|
139
|
-
end
|
140
|
-
|
141
141
|
def update_dna
|
142
142
|
@logger.debug "Getting instance's DNA"
|
143
143
|
|
@@ -145,11 +145,28 @@ module EY::Enzyme
|
|
145
145
|
raise DNAError, "failed to fetch DNA"
|
146
146
|
end
|
147
147
|
|
148
|
-
json["quick"] = true if @opts[:quick]
|
149
|
-
|
150
148
|
@logger.debug "Writing json dna to file system"
|
149
|
+
update_main_dna(json)
|
150
|
+
json
|
151
|
+
end
|
152
|
+
|
153
|
+
def update_main_dna(json)
|
154
|
+
main_json = json.dup
|
155
|
+
main_json['run_list'] = 'recipe[ey-base]'
|
156
|
+
main_json["quick"] = true if @opts[:quick]
|
157
|
+
update_chef_dna("/etc/chef/dna.json", main_json)
|
158
|
+
end
|
159
|
+
|
160
|
+
def update_custom_dna(json)
|
161
|
+
custom_json = json.dup
|
162
|
+
custom_json['run_list'] = 'recipe[main]'
|
163
|
+
# Make sure the path exist, it's soooo wrong to write this file before the cookbooks have been downloaded nor the config written
|
164
|
+
FileUtils.mkdir_p('/etc/chef-custom/') unless File.exists?('/etc/chef-custom/')
|
165
|
+
update_chef_dna("/etc/chef-custom/dna.json", custom_json)
|
166
|
+
end
|
151
167
|
|
152
|
-
|
168
|
+
def update_chef_dna(file, json)
|
169
|
+
File.open(file, 'w') do |f|
|
153
170
|
f.puts JSON.pretty_generate(json)
|
154
171
|
f.chmod(0600)
|
155
172
|
end
|
@@ -49,7 +49,7 @@ module EY::Enzyme
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def execute
|
52
|
-
command = "#{@opts[:chef_bin]} -j
|
52
|
+
command = "#{@opts[:chef_bin]} -j #{chef_dna} -c #{chef_config} -r \"#{@recipes_url}\" > #{@chef_log} 2>&1"
|
53
53
|
@logger.debug "Running: #{command}"
|
54
54
|
if system(command)
|
55
55
|
@logger.info "Running telinit"
|
@@ -90,6 +90,10 @@ module EY::Enzyme
|
|
90
90
|
main? ? "/etc/chef/solo.rb" : "/etc/chef-custom/solo.rb"
|
91
91
|
end
|
92
92
|
|
93
|
+
def chef_dna
|
94
|
+
main? ? '/etc/chef/dna.json' : '/etc/chef-custom/dna.json'
|
95
|
+
end
|
96
|
+
|
93
97
|
def chef_error_from_log
|
94
98
|
unless File.exist?(@chef_log)
|
95
99
|
return "(log doesn't exist)"
|
data/lib/ey_enzyme/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_enzyme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 91
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
|
11
|
-
- 19
|
12
|
-
- 1
|
13
|
-
version: 0.9.45.ruby19.1
|
9
|
+
- 48
|
10
|
+
version: 0.9.48
|
14
11
|
platform: ruby
|
15
12
|
authors:
|
16
13
|
- Engine Yard Inc.
|
@@ -50,44 +47,10 @@ dependencies:
|
|
50
47
|
version: 1.6.1
|
51
48
|
type: :runtime
|
52
49
|
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: chef
|
55
|
-
prerelease: false
|
56
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: -3806225206
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 10
|
65
|
-
- 8
|
66
|
-
- patch
|
67
|
-
- 3
|
68
|
-
version: 0.10.8.patch3
|
69
|
-
type: :runtime
|
70
|
-
version_requirements: *id003
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: chef-deploy
|
73
|
-
prerelease: false
|
74
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
|
-
requirements:
|
77
|
-
- - "="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
hash: 29
|
80
|
-
segments:
|
81
|
-
- 0
|
82
|
-
- 2
|
83
|
-
- 5
|
84
|
-
version: 0.2.5
|
85
|
-
type: :runtime
|
86
|
-
version_requirements: *id004
|
87
50
|
- !ruby/object:Gem::Dependency
|
88
51
|
name: rake
|
89
52
|
prerelease: false
|
90
|
-
requirement: &
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
91
54
|
none: false
|
92
55
|
requirements:
|
93
56
|
- - ">="
|
@@ -97,11 +60,11 @@ dependencies:
|
|
97
60
|
- 0
|
98
61
|
version: "0"
|
99
62
|
type: :development
|
100
|
-
version_requirements: *
|
63
|
+
version_requirements: *id003
|
101
64
|
- !ruby/object:Gem::Dependency
|
102
65
|
name: rspec
|
103
66
|
prerelease: false
|
104
|
-
requirement: &
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
105
68
|
none: false
|
106
69
|
requirements:
|
107
70
|
- - ~>
|
@@ -112,11 +75,11 @@ dependencies:
|
|
112
75
|
- 2
|
113
76
|
version: "1.2"
|
114
77
|
type: :development
|
115
|
-
version_requirements: *
|
78
|
+
version_requirements: *id004
|
116
79
|
- !ruby/object:Gem::Dependency
|
117
80
|
name: fakeweb
|
118
81
|
prerelease: false
|
119
|
-
requirement: &
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
120
83
|
none: false
|
121
84
|
requirements:
|
122
85
|
- - ">="
|
@@ -126,11 +89,11 @@ dependencies:
|
|
126
89
|
- 0
|
127
90
|
version: "0"
|
128
91
|
type: :development
|
129
|
-
version_requirements: *
|
92
|
+
version_requirements: *id005
|
130
93
|
- !ruby/object:Gem::Dependency
|
131
94
|
name: fakeweb-matcher
|
132
95
|
prerelease: false
|
133
|
-
requirement: &
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
134
97
|
none: false
|
135
98
|
requirements:
|
136
99
|
- - ">="
|
@@ -140,7 +103,7 @@ dependencies:
|
|
140
103
|
- 0
|
141
104
|
version: "0"
|
142
105
|
type: :development
|
143
|
-
version_requirements: *
|
106
|
+
version_requirements: *id006
|
144
107
|
description: Gem for kicking off chef recipes
|
145
108
|
email: ninja@engineyard.com
|
146
109
|
executables:
|
@@ -180,14 +143,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
144
|
none: false
|
182
145
|
requirements:
|
183
|
-
- - "
|
146
|
+
- - ">="
|
184
147
|
- !ruby/object:Gem::Version
|
185
|
-
hash:
|
148
|
+
hash: 3
|
186
149
|
segments:
|
187
|
-
-
|
188
|
-
|
189
|
-
- 1
|
190
|
-
version: 1.3.1
|
150
|
+
- 0
|
151
|
+
version: "0"
|
191
152
|
requirements: []
|
192
153
|
|
193
154
|
rubyforge_project:
|
@@ -197,4 +158,3 @@ specification_version: 3
|
|
197
158
|
summary: Gem for kicking off chef recipes
|
198
159
|
test_files: []
|
199
160
|
|
200
|
-
has_rdoc:
|