rubber 2.0.0.pre5 → 2.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@ require 'erb'
2
2
  require 'find'
3
3
  require 'fileutils'
4
4
  require 'rubber/util'
5
+ require 'tempfile'
5
6
 
6
7
  module Rubber
7
8
  module Configuration
@@ -118,10 +119,25 @@ module Rubber
118
119
  open("#{config_path}.bak", 'w') { |f| f.write(orig) } if config_path && config.backup
119
120
 
120
121
  # Write out transformed file
121
- writer = config_path || "|#{config.write_cmd}"
122
- open(writer, 'w') do |pipe|
123
- pipe.write(result)
122
+ if config_path
123
+ open(config_path, 'w') do |pipe|
124
+ pipe.write(result)
125
+ end
126
+
127
+ # Handle write_cmd by dumping the body to a file and then piping that into the command.
128
+ else
129
+ file = Tempfile.new('rubber_write_cmd')
130
+
131
+ begin
132
+ file.write(result)
133
+ file.close
134
+
135
+ system("cat #{file.path} | #{config.write_cmd}")
136
+ ensure
137
+ file.unlink
138
+ end
124
139
  end
140
+
125
141
  if config.write_cmd && ! fake_root && $?.exitstatus != 0
126
142
  raise "Config command failed execution: #{config.write_cmd}"
127
143
  end
@@ -1,4 +1,4 @@
1
1
  module Rubber
2
- VERSION = "2.0.0.pre5"
2
+ VERSION = "2.0.0.pre6"
3
3
  end
4
4
 
@@ -64,6 +64,28 @@ LoadPlugin notify_email
64
64
 
65
65
  <% end %>
66
66
 
67
+ <%
68
+ ping_hosts = []
69
+ if rubber_instances[rubber_env.host].role_names.include?('graphite_server')
70
+ # monitor all servers from graphite_server
71
+ ping_hosts = rubber_instances.collect {|ic| ic.full_name }.select {|h| h != rubber_env.full_host }
72
+ elsif rubber_instances[rubber_env.host].role_names.include?('web_tools')
73
+ # monitor just graphite_server from tools
74
+ ping_hosts = [rubber_instances.for_role('graphite_server').first.full_name]
75
+ end
76
+ %>
77
+
78
+ <% if ping_hosts.size > 0 %>
79
+
80
+ LoadPlugin ping
81
+ <Plugin "ping">
82
+ <% ping_hosts.each do |h| %>
83
+ Host "<%= h %>"
84
+ <% end %>
85
+ </Plugin>
86
+
87
+ <% end %>
88
+
67
89
  Include "/etc/collectd/conf.d/*.conf"
68
90
  Include "/etc/collectd/thresholds.d/*.conf"
69
91
  Include "/etc/collectd/filters.d/*.conf"
@@ -22,6 +22,18 @@
22
22
  Hysteresis 0.3
23
23
  </Type>
24
24
 
25
+ <Plugin "ping">
26
+ <Type "ping">
27
+ Datasource "value"
28
+ WarningMax 50
29
+ FailureMax 100
30
+ </Type>
31
+ <Type "ping_droprate">
32
+ Datasource "value"
33
+ FailureMax 0.05
34
+ </Type>
35
+ </Plugin>
36
+
25
37
  </Threshold>
26
38
 
27
39
  #<Threshold>
@@ -52,10 +52,10 @@ namespace :rubber do
52
52
  sleep 5
53
53
 
54
54
  create_user_cmd = "CREATE USER #{env.db_user} WITH NOSUPERUSER CREATEDB NOCREATEROLE"
55
- create_user_cmd << "PASSWORD '#{env.db_pass}'" if env.db_pass
55
+ create_user_cmd << " PASSWORD '#{env.db_pass}'" if env.db_pass
56
56
 
57
57
  create_replication_user_cmd = "CREATE USER #{env.db_replication_user} WITH NOSUPERUSER NOCREATEROLE REPLICATION"
58
- create_replication_user_cmd << "PASSWORD '#{env.db_replication_pass}'" if env.db_replication_pass
58
+ create_replication_user_cmd << " PASSWORD '#{env.db_replication_pass}'" if env.db_replication_pass
59
59
 
60
60
  rubber.sudo_script "create_master_db", <<-ENDSCRIPT
61
61
  sudo -u postgres psql -c "#{create_user_cmd}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre5
4
+ version: 2.0.0.pre6
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-24 00:00:00.000000000 Z
13
+ date: 2012-03-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
17
- requirement: &8846840 !ruby/object:Gem::Requirement
17
+ requirement: &11348280 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.8.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *8846840
25
+ version_requirements: *11348280
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: thor
28
- requirement: &8845920 !ruby/object:Gem::Requirement
28
+ requirement: &11347860 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *8845920
36
+ version_requirements: *11347860
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: clamp
39
- requirement: &8844220 !ruby/object:Gem::Requirement
39
+ requirement: &11347400 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *8844220
47
+ version_requirements: *11347400
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: open4
50
- requirement: &8842980 !ruby/object:Gem::Requirement
50
+ requirement: &11346980 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *8842980
58
+ version_requirements: *11346980
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: fog
61
- requirement: &8840680 !ruby/object:Gem::Requirement
61
+ requirement: &11346480 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *8840680
69
+ version_requirements: *11346480
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
- requirement: &8839740 !ruby/object:Gem::Requirement
72
+ requirement: &11346060 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *8839740
80
+ version_requirements: *11346060
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: test-unit
83
- requirement: &13573900 !ruby/object:Gem::Requirement
83
+ requirement: &11361900 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *13573900
91
+ version_requirements: *11361900
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: shoulda-context
94
- requirement: &13573480 !ruby/object:Gem::Requirement
94
+ requirement: &11361480 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *13573480
102
+ version_requirements: *11361480
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: mocha
105
- requirement: &13573060 !ruby/object:Gem::Requirement
105
+ requirement: &11361060 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *13573060
113
+ version_requirements: *11361060
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: ruby-debug19
116
- requirement: &13572640 !ruby/object:Gem::Requirement
116
+ requirement: &11360640 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,7 +121,7 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *13572640
124
+ version_requirements: *11360640
125
125
  description: ! " The rubber plugin enables relatively complex multi-instance deployments
126
126
  of RubyOnRails applications to\n Amazon's Elastic Compute Cloud (EC2). Like
127
127
  capistrano, rubber is role based, so you can define a set\n of configuration
@@ -506,7 +506,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
506
506
  version: '0'
507
507
  segments:
508
508
  - 0
509
- hash: 509756412491793944
509
+ hash: -3050976247343600522
510
510
  required_rubygems_version: !ruby/object:Gem::Requirement
511
511
  none: false
512
512
  requirements:
@@ -515,7 +515,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
515
515
  version: 1.3.1
516
516
  requirements: []
517
517
  rubyforge_project: rubber
518
- rubygems_version: 1.8.15
518
+ rubygems_version: 1.8.17
519
519
  signing_key:
520
520
  specification_version: 3
521
521
  summary: A capistrano plugin for managing multi-instance deployments to the cloud