vanagon 0.17.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bin/build +3 -1
- data/bin/build_host_info +3 -1
- data/bin/build_requirements +3 -1
- data/bin/inspect +3 -1
- data/bin/render +3 -1
- data/bin/repo +3 -1
- data/bin/ship +3 -1
- data/bin/sign +3 -1
- data/extras/completions/vanagon.bash +38 -0
- data/extras/completions/vanagon.zsh +41 -0
- data/lib/vanagon/cli.rb +12 -2
- data/lib/vanagon/cli/build.rb +12 -3
- data/lib/vanagon/cli/build_host_info.rb +12 -3
- data/lib/vanagon/cli/build_requirements.rb +13 -5
- data/lib/vanagon/cli/completion.rb +44 -0
- data/lib/vanagon/cli/inspect.rb +12 -3
- data/lib/vanagon/cli/list.rb +74 -0
- data/lib/vanagon/cli/render.rb +11 -2
- data/lib/vanagon/cli/ship.rb +5 -4
- data/lib/vanagon/cli/sign.rb +3 -2
- data/lib/vanagon/component.rb +13 -10
- data/lib/vanagon/component/dsl.rb +27 -20
- data/lib/vanagon/component/source.rb +2 -1
- data/lib/vanagon/component/source/git.rb +35 -10
- data/lib/vanagon/component/source/http.rb +3 -2
- data/lib/vanagon/component/source/local.rb +2 -1
- data/lib/vanagon/component/source/rewrite.rb +3 -2
- data/lib/vanagon/driver.rb +35 -34
- data/lib/vanagon/engine/always_be_scheduling.rb +12 -11
- data/lib/vanagon/engine/docker.rb +2 -1
- data/lib/vanagon/engine/ec2.rb +5 -4
- data/lib/vanagon/engine/hardware.rb +4 -3
- data/lib/vanagon/engine/pooler.rb +6 -5
- data/lib/vanagon/environment.rb +3 -2
- data/lib/vanagon/logger.rb +31 -0
- data/lib/vanagon/platform.rb +38 -5
- data/lib/vanagon/platform/deb.rb +2 -0
- data/lib/vanagon/platform/dsl.rb +23 -6
- data/lib/vanagon/platform/windows.rb +3 -1
- data/lib/vanagon/project.rb +25 -15
- data/lib/vanagon/project/dsl.rb +6 -5
- data/lib/vanagon/utilities.rb +5 -4
- data/resources/deb/control.erb +1 -1
- data/resources/deb/postinst.erb +24 -13
- data/resources/deb/postrm.erb +9 -6
- data/resources/deb/prerm.erb +18 -8
- data/resources/osx/postinstall.erb +5 -1
- data/resources/rpm/project.spec.erb +12 -12
- data/resources/solaris/10/depend.erb +2 -2
- data/resources/solaris/10/postinstall.erb +10 -2
- data/resources/solaris/11/p5m.erb +2 -2
- data/spec/lib/vanagon/cli_spec.rb +143 -0
- data/spec/lib/vanagon/component/dsl_spec.rb +54 -10
- data/spec/lib/vanagon/component/source/git_spec.rb +4 -4
- data/spec/lib/vanagon/component_spec.rb +15 -2
- data/spec/lib/vanagon/driver_spec.rb +1 -1
- data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +4 -4
- data/spec/lib/vanagon/platform_spec.rb +80 -0
- data/spec/lib/vanagon/utilities_spec.rb +4 -1
- metadata +37 -32
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/utilities'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'vanagon/component/source/local'
|
3
4
|
require 'net/http'
|
4
5
|
require 'uri'
|
@@ -93,7 +94,7 @@ class Vanagon
|
|
93
94
|
#
|
94
95
|
# @raise [RuntimeError] an exception is raised if the sum does not match the sum of the file
|
95
96
|
def verify # rubocop:disable Metrics/AbcSize
|
96
|
-
|
97
|
+
VanagonLogger.info "Verifying file: #{file} against sum: '#{sum}'"
|
97
98
|
actual = get_sum(File.join(workdir, file), sum_type)
|
98
99
|
return true if sum == actual
|
99
100
|
|
@@ -107,7 +108,7 @@ class Vanagon
|
|
107
108
|
uri = URI.parse(target_url.to_s)
|
108
109
|
target_file ||= File.basename(uri.path)
|
109
110
|
|
110
|
-
|
111
|
+
VanagonLogger.info "Downloading file '#{target_file}' from url '#{target_url}'"
|
111
112
|
|
112
113
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
113
114
|
http.request(Net::HTTP::Get.new(uri, headers)) do |response|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/utilities'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
|
3
4
|
class Vanagon
|
4
5
|
class Component
|
@@ -57,7 +58,7 @@ class Vanagon
|
|
57
58
|
#
|
58
59
|
# @raise [RuntimeError, Vanagon::Error] an exception is raised if the URI scheme cannot be handled
|
59
60
|
def copy
|
60
|
-
|
61
|
+
VanagonLogger.info "Copying file '#{url.basename}' to workdir"
|
61
62
|
|
62
63
|
FileUtils.cp_r(url, file)
|
63
64
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/component/source'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
|
3
4
|
class Vanagon
|
4
5
|
class Component
|
@@ -16,7 +17,7 @@ class Vanagon
|
|
16
17
|
# @deprecated Please use the component DSL method #mirror(<URI>)
|
17
18
|
# instead. This method will be removed before Vanagon 1.0.0.
|
18
19
|
def register_rewrite_rule(protocol, rule)
|
19
|
-
|
20
|
+
VanagonLogger.info <<-HERE.undent
|
20
21
|
rewrite rule support is deprecated and will be removed before Vanagon 1.0.0.
|
21
22
|
Rewritten URLs will be automatically converted into mirror URLs for now but
|
22
23
|
please use the component DSL method '#mirror url' to define new mirror URL
|
@@ -76,7 +77,7 @@ class Vanagon
|
|
76
77
|
def parse_and_rewrite(uri)
|
77
78
|
return uri if rewrite_rules.empty?
|
78
79
|
if !!uri.match(/^git:http/)
|
79
|
-
|
80
|
+
VanagonLogger.info <<-HERE.undent
|
80
81
|
`fustigit` parsing doesn't get along with how we specify the source
|
81
82
|
type by prefixing `git`. As `rewrite_rules` are deprecated, we'll
|
82
83
|
replace `git:http` with `http` in your uri. At some point this will
|
data/lib/vanagon/driver.rb
CHANGED
@@ -4,6 +4,7 @@ require 'vanagon/component'
|
|
4
4
|
require 'vanagon/utilities'
|
5
5
|
require 'vanagon/common'
|
6
6
|
require 'vanagon/errors'
|
7
|
+
require 'vanagon/logger'
|
7
8
|
require 'tmpdir'
|
8
9
|
require 'logger'
|
9
10
|
|
@@ -20,33 +21,29 @@ class Vanagon
|
|
20
21
|
@retry_count ||= @project.retry_count || ENV["VANAGON_RETRY_COUNT"] || 1
|
21
22
|
end
|
22
23
|
|
23
|
-
def initialize(platform, project, options = {
|
24
|
-
@
|
25
|
-
@
|
24
|
+
def initialize(platform, project, options = {}) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
|
25
|
+
@options = options
|
26
|
+
@verbose = options[:verbose] || false
|
27
|
+
@preserve = options[:preserve] || false
|
26
28
|
@workdir = options[:workdir] || Dir.mktmpdir
|
27
29
|
|
28
30
|
@@configdir = options[:configdir] || File.join(Dir.pwd, "configs")
|
29
31
|
components = options[:components] || []
|
30
32
|
only_build = options[:only_build]
|
31
|
-
target = options[:target]
|
32
33
|
|
33
34
|
@platform = Vanagon::Platform.load_platform(platform, File.join(@@configdir, "platforms"))
|
34
|
-
@project = Vanagon::Project.load_project(
|
35
|
+
@project = Vanagon::Project.load_project(
|
36
|
+
project, File.join(@@configdir, "projects"), @platform, components
|
37
|
+
)
|
35
38
|
@project.settings[:verbose] = options[:verbose]
|
36
|
-
@project.settings[:skipcheck] = options[:skipcheck]
|
39
|
+
@project.settings[:skipcheck] = options[:skipcheck] || false
|
37
40
|
filter_out_components(only_build) if only_build
|
38
41
|
loginit('vanagon_hosts.log')
|
39
42
|
|
40
43
|
@remote_workdir = options[:"remote-workdir"]
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
load_engine_object(options[:engine], @platform, target)
|
45
|
-
else
|
46
|
-
# Use 'pooler' as a default, but also apply selection logic that may
|
47
|
-
# choose something different based on platform configuration.
|
48
|
-
load_engine('pooler', @platform, target)
|
49
|
-
end
|
45
|
+
engine = pick_engine(options)
|
46
|
+
load_engine_object(engine, @platform, options[:target])
|
50
47
|
end
|
51
48
|
|
52
49
|
def filter_out_components(only_build)
|
@@ -54,29 +51,31 @@ class Vanagon
|
|
54
51
|
# flatten all the results in to one array and set project.components to that.
|
55
52
|
@project.components = only_build.flat_map { |comp| @project.filter_component(comp) }.uniq
|
56
53
|
if @verbose
|
57
|
-
|
58
|
-
@project.components.each { |comp|
|
54
|
+
VanagonLogger.info "Only building:"
|
55
|
+
@project.components.each { |comp| VanagonLogger.info comp.name }
|
59
56
|
end
|
60
57
|
end
|
61
58
|
|
62
|
-
def
|
63
|
-
if
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
def pick_engine(options) # rubocop:disable Metrics/PerceivedComplexity
|
60
|
+
if options[:engine] && !options[:target]
|
61
|
+
options[:engine]
|
62
|
+
elsif @platform.build_hosts
|
63
|
+
'hardware'
|
64
|
+
elsif @platform.aws_ami
|
65
|
+
'ec2'
|
66
|
+
elsif @platform.docker_image
|
67
|
+
'docker'
|
68
|
+
elsif options[:target]
|
69
|
+
'base'
|
70
|
+
else
|
71
|
+
'always_be_scheduling'
|
73
72
|
end
|
74
|
-
load_engine_object(engine_type, platform, target)
|
75
73
|
end
|
76
74
|
|
77
75
|
def load_engine_object(engine_type, platform, target)
|
78
76
|
require "vanagon/engine/#{engine_type}"
|
79
|
-
@engine = Object::const_get("Vanagon::Engine::#{camelize(engine_type)}")
|
77
|
+
@engine = Object::const_get("Vanagon::Engine::#{camelize(engine_type)}")
|
78
|
+
.new(platform, target, remote_workdir: remote_workdir)
|
80
79
|
rescue StandardError, ScriptError => e
|
81
80
|
raise Vanagon::Error.wrap(e, "Could not load the desired engine '#{engine_type}'")
|
82
81
|
end
|
@@ -103,7 +102,9 @@ class Vanagon
|
|
103
102
|
{ "name" => @engine.build_host_name, "engine" => @engine.name }
|
104
103
|
end
|
105
104
|
|
106
|
-
# Returns the set difference between the build_requires and the
|
105
|
+
# Returns the set difference between the build_requires and the
|
106
|
+
# components to get a list of external dependencies that need to
|
107
|
+
# be installed.
|
107
108
|
def list_build_dependencies
|
108
109
|
@project.components.map(&:build_requires).flatten.uniq - @project.components.map(&:name)
|
109
110
|
end
|
@@ -134,7 +135,7 @@ class Vanagon
|
|
134
135
|
end
|
135
136
|
|
136
137
|
@engine.startup(workdir)
|
137
|
-
|
138
|
+
VanagonLogger.info "Target is #{@engine.target}"
|
138
139
|
Vanagon::Utilities.retry_with_timeout(retry_count, timeout) do
|
139
140
|
install_build_dependencies
|
140
141
|
end
|
@@ -159,8 +160,8 @@ class Vanagon
|
|
159
160
|
@engine.teardown
|
160
161
|
cleanup_workdir
|
161
162
|
end
|
162
|
-
|
163
|
-
|
163
|
+
VanagonLogger.error(e)
|
164
|
+
VanagonLogger.error e.backtrace.join("\n")
|
164
165
|
raise e
|
165
166
|
ensure
|
166
167
|
if ["hardware", "ec2"].include?(@engine.name)
|
@@ -174,7 +175,7 @@ class Vanagon
|
|
174
175
|
raise Vanagon::Error, "Project requires a version set, all is lost."
|
175
176
|
end
|
176
177
|
|
177
|
-
|
178
|
+
VanagonLogger.info "rendering Makefile"
|
178
179
|
@project.fetch_sources(workdir, retry_count, timeout)
|
179
180
|
@project.make_bill_of_materials(workdir)
|
180
181
|
@project.generate_packaging_artifacts(workdir)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'vanagon/engine/base'
|
3
|
+
require 'vanagon/logger'
|
3
4
|
require 'yaml'
|
4
5
|
|
5
6
|
class Vanagon
|
@@ -141,14 +142,14 @@ class Vanagon
|
|
141
142
|
absolute_path = File.expand_path(path)
|
142
143
|
return nil unless File.exist?(absolute_path)
|
143
144
|
|
144
|
-
|
145
|
+
VanagonLogger.info "Reading ABS token from: #{path}"
|
145
146
|
contents = File.read(absolute_path).chomp
|
146
147
|
lines = contents.each_line.map(&:chomp)
|
147
148
|
|
148
149
|
abs = lines.shift
|
149
150
|
@token_vmpooler = lines.shift
|
150
151
|
|
151
|
-
|
152
|
+
VanagonLogger.info "Please add a second line with the vmpooler token to be able to modify or see the VM in floaty/bit-bar" if @token_vmpooler.nil?
|
152
153
|
return abs
|
153
154
|
end
|
154
155
|
private :read_vanagon_token
|
@@ -217,7 +218,7 @@ class Vanagon
|
|
217
218
|
message.concat(" with a vmpooler_fallback token")
|
218
219
|
end
|
219
220
|
end
|
220
|
-
|
221
|
+
VanagonLogger.info message
|
221
222
|
return abs_token
|
222
223
|
end
|
223
224
|
private :read_vmfloaty_token
|
@@ -235,7 +236,7 @@ class Vanagon
|
|
235
236
|
def select_target_from(pooler) # rubocop:disable Metrics/AbcSize
|
236
237
|
request_object = build_request_object
|
237
238
|
|
238
|
-
|
239
|
+
VanagonLogger.info "Requesting VMs with job_id: #{@saved_job_id}. Will poll for up to an hour."
|
239
240
|
#the initial request is always replied with "come back again"
|
240
241
|
response = Vanagon::Utilities.http_request_generic(
|
241
242
|
"#{pooler}/request",
|
@@ -245,10 +246,10 @@ class Vanagon
|
|
245
246
|
)
|
246
247
|
|
247
248
|
unless response.code == "202"
|
248
|
-
|
249
|
+
VanagonLogger.info "failed to request ABS with code #{response.code}"
|
249
250
|
if valid_json?(response.body)
|
250
251
|
response_json = JSON.parse(response.body)
|
251
|
-
|
252
|
+
VanagonLogger.info "reason: #{response_json['reason']}"
|
252
253
|
end
|
253
254
|
return ''
|
254
255
|
end
|
@@ -278,12 +279,12 @@ class Vanagon
|
|
278
279
|
|
279
280
|
sleep_seconds = 10 if i >= 10
|
280
281
|
sleep_seconds = i if i < 10
|
281
|
-
|
282
|
+
VanagonLogger.info "Waiting #{sleep_seconds} seconds to check if ABS request has been filled. (x#{i})"
|
282
283
|
|
283
284
|
sleep(sleep_seconds)
|
284
285
|
end
|
285
286
|
rescue SystemExit, Interrupt
|
286
|
-
|
287
|
+
VanagonLogger.error "\nVanagon interrupted during mains ABS polling. Make sure you delete the requested job_id #{@saved_job_id}"
|
287
288
|
raise
|
288
289
|
end
|
289
290
|
response_body = translated(response_body, @saved_job_id)
|
@@ -321,14 +322,14 @@ class Vanagon
|
|
321
322
|
)
|
322
323
|
if response && response.body == 'OK'
|
323
324
|
Vanagon::Driver.logger.info "#{@saved_job_id} has been scheduled for removal"
|
324
|
-
|
325
|
+
VanagonLogger.info "#{@saved_job_id} has been scheduled for removal"
|
325
326
|
else
|
326
327
|
Vanagon::Driver.logger.info "#{@saved_job_id} could not be scheduled for removal: #{response.body}"
|
327
|
-
|
328
|
+
VanagonLogger.info "#{@saved_job_id} could not be scheduled for removal"
|
328
329
|
end
|
329
330
|
rescue Vanagon::Error => e
|
330
331
|
Vanagon::Driver.logger.info "#{@saved_job_id} could not be scheduled for removal (#{e.message})"
|
331
|
-
|
332
|
+
VanagonLogger.info "#{@saved_job_id} could not be scheduled for removal (#{e.message})"
|
332
333
|
end
|
333
334
|
|
334
335
|
private
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/engine/base'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
|
3
4
|
class Vanagon
|
4
5
|
class Engine
|
@@ -52,7 +53,7 @@ class Vanagon
|
|
52
53
|
Vanagon::Utilities.ex("#{@docker_cmd} stop #{build_host_name}-builder")
|
53
54
|
Vanagon::Utilities.ex("#{@docker_cmd} rm #{build_host_name}-builder")
|
54
55
|
rescue Vanagon::Error => e
|
55
|
-
|
56
|
+
VanagonLogger.error "There was a problem tearing down the docker container #{build_host_name}-builder (#{e.message})."
|
56
57
|
end
|
57
58
|
|
58
59
|
def dispatch(command, return_output = false)
|
data/lib/vanagon/engine/ec2.rb
CHANGED
@@ -2,6 +2,7 @@ require 'aws-sdk'
|
|
2
2
|
require 'erb'
|
3
3
|
require 'base64'
|
4
4
|
require 'vanagon/engine/base'
|
5
|
+
require 'vanagon/logger'
|
5
6
|
|
6
7
|
class Vanagon
|
7
8
|
class Engine
|
@@ -57,17 +58,17 @@ class Vanagon
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def select_target
|
60
|
-
|
61
|
-
|
61
|
+
VanagonLogger.info "Instance created id: #{instance.id}"
|
62
|
+
VanagonLogger.info "Created instance waiting for status ok"
|
62
63
|
@ec2.wait_until(:instance_status_ok, instance_ids: [instance.id])
|
63
|
-
|
64
|
+
VanagonLogger.info "Instance running"
|
64
65
|
@target = instance.private_ip_address
|
65
66
|
rescue ::Aws::Waiters::Errors::WaiterFailed => error
|
66
67
|
fail "Failed to wait for ec2 instance to start got error #{error}"
|
67
68
|
end
|
68
69
|
|
69
70
|
def teardown
|
70
|
-
|
71
|
+
VanagonLogger.info "Destroying instance on AWS id: #{instance.id}"
|
71
72
|
instances.batch_terminate!
|
72
73
|
end
|
73
74
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/engine/base'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'json'
|
3
4
|
require 'lock_manager'
|
4
5
|
|
@@ -23,7 +24,7 @@ class Vanagon
|
|
23
24
|
Vanagon::Driver.logger.info "Polling for a lock on #{host}."
|
24
25
|
@lockman.polling_lock(host, VANAGON_LOCK_USER, "Vanagon automated lock")
|
25
26
|
Vanagon::Driver.logger.info "Lock acquired on #{host}."
|
26
|
-
|
27
|
+
VanagonLogger.info "Lock acquired on #{host} for #{VANAGON_LOCK_USER}."
|
27
28
|
host
|
28
29
|
end
|
29
30
|
|
@@ -33,7 +34,7 @@ class Vanagon
|
|
33
34
|
Vanagon::Driver.logger.info "Attempting to lock #{h}."
|
34
35
|
if @lockman.lock(h, VANAGON_LOCK_USER, "Vanagon automated lock")
|
35
36
|
Vanagon::Driver.logger.info "Lock acquired on #{h}."
|
36
|
-
|
37
|
+
VanagonLogger.info "Lock acquired on #{h} for #{VANAGON_LOCK_USER}."
|
37
38
|
return h
|
38
39
|
end
|
39
40
|
end
|
@@ -45,7 +46,7 @@ class Vanagon
|
|
45
46
|
# complete. In this case, we'll attempt to unlock the hardware
|
46
47
|
def teardown
|
47
48
|
Vanagon::Driver.logger.info "Removing lock on #{@target}."
|
48
|
-
|
49
|
+
VanagonLogger.info "Removing lock on #{@target}."
|
49
50
|
@lockman.unlock(@target, VANAGON_LOCK_USER)
|
50
51
|
end
|
51
52
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/engine/base'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'yaml'
|
3
4
|
|
4
5
|
### Note this class is deprecated in favor of using the ABS Engine. The pooler has changed it's API with regards to
|
@@ -60,7 +61,7 @@ class Vanagon
|
|
60
61
|
absolute_path = File.expand_path(path)
|
61
62
|
return nil unless File.exist?(absolute_path)
|
62
63
|
|
63
|
-
|
64
|
+
VanagonLogger.info "Reading vmpooler token from: #{path}"
|
64
65
|
File.read(absolute_path).chomp
|
65
66
|
end
|
66
67
|
private :read_vanagon_token
|
@@ -74,7 +75,7 @@ class Vanagon
|
|
74
75
|
absolute_path = File.expand_path(path)
|
75
76
|
return nil unless File.exist?(absolute_path)
|
76
77
|
|
77
|
-
|
78
|
+
VanagonLogger.info "Reading vmpooler token from: #{path}"
|
78
79
|
YAML.load_file(absolute_path)['token']
|
79
80
|
end
|
80
81
|
private :read_vmfloaty_token
|
@@ -145,14 +146,14 @@ class Vanagon
|
|
145
146
|
)
|
146
147
|
if response and response["ok"]
|
147
148
|
Vanagon::Driver.logger.info "#{@target} has been destroyed"
|
148
|
-
|
149
|
+
VanagonLogger.info "#{@target} has been destroyed"
|
149
150
|
else
|
150
151
|
Vanagon::Driver.logger.info "#{@target} could not be destroyed"
|
151
|
-
|
152
|
+
VanagonLogger.info "#{@target} could not be destroyed"
|
152
153
|
end
|
153
154
|
rescue Vanagon::Error => e
|
154
155
|
Vanagon::Driver.logger.info "#{@target} could not be destroyed (#{e.message})"
|
155
|
-
|
156
|
+
VanagonLogger.error "#{@target} could not be destroyed (#{e.message})"
|
156
157
|
end
|
157
158
|
end
|
158
159
|
end
|
data/lib/vanagon/environment.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
require 'vanagon/extensions/string'
|
3
|
+
require 'vanagon/logger'
|
3
4
|
|
4
5
|
class Vanagon
|
5
6
|
# Environment is a validating wrapper around a delegated Hash,
|
@@ -147,7 +148,7 @@ class Vanagon
|
|
147
148
|
update your project's parameters.
|
148
149
|
WARNING
|
149
150
|
|
150
|
-
|
151
|
+
VanagonLogger.info warning.join("\n")
|
151
152
|
str.gsub(pattern, '$(shell \1)')
|
152
153
|
end
|
153
154
|
private :sanitize_subshells
|
@@ -165,7 +166,7 @@ class Vanagon
|
|
165
166
|
update your project's parameters.
|
166
167
|
WARNING
|
167
168
|
|
168
|
-
|
169
|
+
VanagonLogger.info warning.join("\n")
|
169
170
|
str.gsub(pattern, '$(\1)')
|
170
171
|
end
|
171
172
|
private :sanitize_variables
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
class VanagonLogger < ::Logger
|
4
|
+
def self.logger
|
5
|
+
@@logger ||= VanagonLogger.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.debug_logger
|
9
|
+
@@debug_logger ||= VanagonLogger.new(STDERR)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.info(msg)
|
13
|
+
VanagonLogger.debug_logger.info msg
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.warn(msg)
|
17
|
+
VanagonLogger.logger.warn msg
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.error(msg)
|
21
|
+
VanagonLogger.logger.error msg
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(output = STDOUT)
|
25
|
+
super(output)
|
26
|
+
self.level = ::Logger::INFO
|
27
|
+
self.formatter = proc do |severity, datetime, progname, msg|
|
28
|
+
"#{msg}\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|