buratino 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/buratino.rb +1 -1
- data/lib/buratino/dirs.rb +14 -14
- data/lib/buratino/hg.rb +27 -27
- data/lib/buratino/version.rb +1 -1
- metadata +2 -2
data/lib/buratino.rb
CHANGED
@@ -16,7 +16,7 @@ module Buratino
|
|
16
16
|
puts "DEBUG BURATINO::RUNNER::RUN::NEW_ITERATION"
|
17
17
|
Buratino::Dirs.check(@config)
|
18
18
|
Buratino::Hg.process(@config)
|
19
|
-
Buratino::Dirs.reports(@config)
|
19
|
+
# Buratino::Dirs.reports(@config)
|
20
20
|
puts "DEBUG BURATINO::RUNNER::RUN::END_ITERATION"
|
21
21
|
break if @config['angel']
|
22
22
|
sleep @config['interval']
|
data/lib/buratino/dirs.rb
CHANGED
@@ -9,31 +9,31 @@ module Buratino
|
|
9
9
|
puts "DEBUG BURATINO::DIRS::CHECK"
|
10
10
|
self.clean(config)
|
11
11
|
@hostname = Facter.fqdn
|
12
|
-
Buratino::Hg.reports_dir(config)
|
13
|
-
Dir.mkdir("#{config['reports_dir']}/#{@hostname}") until File.exist? "#{config['reports_dir']}/#{@hostname}"
|
12
|
+
# Buratino::Hg.reports_dir(config)
|
13
|
+
# Dir.mkdir("#{config['reports_dir']}/#{@hostname}") until File.exist? "#{config['reports_dir']}/#{@hostname}"
|
14
14
|
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.reports(config)
|
18
|
-
puts "DEBUG BURATINO::DIRS::REPORTS"
|
19
|
-
reports = ["last_run_report.yaml", "last_run_summary.yaml", "state.yaml"]
|
20
|
-
reports.each do |report|
|
21
|
-
FileUtils.cp("/var/lib/puppet/state/#{report}", "#{config['reports_dir']}/#{@hostname}")
|
22
|
-
end
|
17
|
+
# def self.reports(config)
|
18
|
+
# puts "DEBUG BURATINO::DIRS::REPORTS"
|
19
|
+
# reports = ["last_run_report.yaml", "last_run_summary.yaml", "state.yaml"]
|
20
|
+
# reports.each do |report|
|
21
|
+
# FileUtils.cp("/var/lib/puppet/state/#{report}", "#{config['reports_dir']}/#{@hostname}")
|
22
|
+
# end
|
23
23
|
|
24
|
-
File.open("#{config['reports_dir']}/#{@hostname}/facts.yaml", 'w') do |file|
|
25
|
-
file.write(Facter.to_hash.to_yaml)
|
26
|
-
end
|
24
|
+
# File.open("#{config['reports_dir']}/#{@hostname}/facts.yaml", 'w') do |file|
|
25
|
+
# file.write(Facter.to_hash.to_yaml)
|
26
|
+
# end
|
27
27
|
|
28
|
-
Buratino::Hg.send_reports(config)
|
29
|
-
end
|
28
|
+
# Buratino::Hg.send_reports(config)
|
29
|
+
# end
|
30
30
|
|
31
31
|
def self.clean(config)
|
32
32
|
puts "DEBUG BURATINO::DIRS::CLEAN"
|
33
33
|
case config['mode']
|
34
34
|
when 'clone'
|
35
35
|
FileUtils.rm_r(config['destination'], :force => true) while File.exist? config['destination']
|
36
|
-
FileUtils.rm_r(config['reports_dir'], :force => true) while File.exist? config['reports_dir']
|
36
|
+
# FileUtils.rm_r(config['reports_dir'], :force => true) while File.exist? config['reports_dir']
|
37
37
|
|
38
38
|
when 'update'
|
39
39
|
puts "No cleans in update mode"
|
data/lib/buratino/hg.rb
CHANGED
@@ -29,37 +29,37 @@ module Buratino
|
|
29
29
|
puppet = `export FACTER_fqdn=#{config['fqdn']}; #{Gem.bindir}/puppet apply --modulepath=#{config['destination']}/modules #{config['destination']}/manifests/site.pp`
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.reports_dir(config)
|
33
|
-
puts "DEBUG BURATINO::HG::REPORTS_DIR"
|
34
|
-
@cmd_options = {}
|
32
|
+
# def self.reports_dir(config)
|
33
|
+
# puts "DEBUG BURATINO::HG::REPORTS_DIR"
|
34
|
+
# @cmd_options = {}
|
35
35
|
|
36
|
-
case config['mode']
|
37
|
-
when 'clone'
|
38
|
-
Mercurial::Repository.clone( config['reports'] , config['reports_dir'], @cmd_options)
|
39
|
-
when 'update'
|
40
|
-
reports_repos = Mercurial::Repository.open( config['reports_dir'] )
|
41
|
-
reports_repos.pull( 'default', '--update')
|
36
|
+
# case config['mode']
|
37
|
+
# when 'clone'
|
38
|
+
# Mercurial::Repository.clone( config['reports'] , config['reports_dir'], @cmd_options)
|
39
|
+
# when 'update'
|
40
|
+
# reports_repos = Mercurial::Repository.open( config['reports_dir'] )
|
41
|
+
# reports_repos.pull( 'default', '--update')
|
42
42
|
|
43
|
-
else
|
44
|
-
puts "Wrong mode!!!"
|
43
|
+
# else
|
44
|
+
# puts "Wrong mode!!!"
|
45
45
|
|
46
|
-
end
|
47
|
-
end
|
46
|
+
# end
|
47
|
+
# end
|
48
48
|
|
49
|
-
def self.send_reports(config)
|
50
|
-
puts "DEBUG BURATINO::HG::SEND_REPORTS"
|
51
|
-
message = "New report from #{Facter.fqdn}"
|
52
|
-
Mercurial::Shell.run("add", :append_hg => true, :in => config['reports_dir'])
|
53
|
-
begin
|
54
|
-
Mercurial::Shell.run(["commit -m ?", message], :append_hg => true, :in => config['reports_dir'])
|
55
|
-
Mercurial::Shell.run("push", :append_hg => true, :in => config['reports_dir'])
|
56
|
-
rescue Mercurial::CommandError => errmsg
|
57
|
-
puts "Something wrong...trying update(pull --update) first"
|
58
|
-
reports_repos = Mercurial::Repository.open( config['reports_dir'] )
|
59
|
-
reports_repos.pull( 'default', '--update')
|
60
|
-
retry
|
61
|
-
end
|
62
|
-
end
|
49
|
+
# def self.send_reports(config)
|
50
|
+
# puts "DEBUG BURATINO::HG::SEND_REPORTS"
|
51
|
+
# message = "New report from #{Facter.fqdn}"
|
52
|
+
# Mercurial::Shell.run("add", :append_hg => true, :in => config['reports_dir'])
|
53
|
+
# begin
|
54
|
+
# Mercurial::Shell.run(["commit -m ?", message], :append_hg => true, :in => config['reports_dir'])
|
55
|
+
# Mercurial::Shell.run("push", :append_hg => true, :in => config['reports_dir'])
|
56
|
+
# rescue Mercurial::CommandError => errmsg
|
57
|
+
# puts "Something wrong...trying update(pull --update) first"
|
58
|
+
# reports_repos = Mercurial::Repository.open( config['reports_dir'] )
|
59
|
+
# reports_repos.pull( 'default', '--update')
|
60
|
+
# retry
|
61
|
+
# end
|
62
|
+
# end
|
63
63
|
|
64
64
|
end
|
65
65
|
end
|
data/lib/buratino/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buratino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mercurial-ruby
|