chef-deploy-application 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -102,6 +102,7 @@ class Chef::Application::DeployApplication < Chef::Application
|
|
102
102
|
def initialize
|
103
103
|
super
|
104
104
|
|
105
|
+
@apps = []
|
105
106
|
@chef_client = nil
|
106
107
|
@chef_client_json = nil
|
107
108
|
end
|
@@ -148,6 +149,29 @@ class Chef::Application::DeployApplication < Chef::Application
|
|
148
149
|
end
|
149
150
|
end
|
150
151
|
|
152
|
+
def configure_chef
|
153
|
+
@apps = parse_options
|
154
|
+
|
155
|
+
begin
|
156
|
+
case config[:config_file]
|
157
|
+
when /^(http|https):\/\//
|
158
|
+
Chef::REST.new("", nil, nil).fetch(config[:config_file]) { |f| apply_config(f.path) }
|
159
|
+
else
|
160
|
+
::File::open(config[:config_file]) { |f| apply_config(f.path) }
|
161
|
+
end
|
162
|
+
rescue SocketError => error
|
163
|
+
Chef::Application.fatal!("Error getting config file #{Chef::Config[:config_file]}", 2)
|
164
|
+
rescue Exception => error
|
165
|
+
Chef::Log.warn("*****************************************")
|
166
|
+
Chef::Log.warn("Can not find config file: #{config[:config_file]}, using defaults.")
|
167
|
+
Chef::Log.warn("#{error.message}")
|
168
|
+
Chef::Log.warn("*****************************************")
|
169
|
+
|
170
|
+
Chef::Config.merge!(config)
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
151
175
|
def configure_logging
|
152
176
|
super
|
153
177
|
Mixlib::Authentication::Log.use_log_devices( Chef::Log )
|
@@ -210,7 +234,7 @@ class Chef::Application::DeployApplication < Chef::Application
|
|
210
234
|
|
211
235
|
server_roles = (app["server_roles"] & node.run_list.roles)
|
212
236
|
if server_roles.empty?
|
213
|
-
Chef::Log.info("None of this server's roles match the app's server_roles.")
|
237
|
+
Chef::Log.info("None of this server's roles match the app's server_roles. Double-check the server_roles configured in the app's data bag.")
|
214
238
|
else
|
215
239
|
server_roles.each do |app_role|
|
216
240
|
app["type"][app_role].each do |thing|
|
@@ -246,11 +270,11 @@ class Chef::Application::DeployApplication < Chef::Application
|
|
246
270
|
|
247
271
|
def application_name
|
248
272
|
return nil if no_app_name_given?
|
249
|
-
|
273
|
+
@apps.first
|
250
274
|
end
|
251
275
|
|
252
276
|
def no_app_name_given?
|
253
|
-
|
277
|
+
@apps.empty?
|
254
278
|
end
|
255
279
|
|
256
280
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-deploy-application
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Porter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: chef
|