kytoon 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ * Mon Jul 23 2012 Dan Prince <dprince@redhat.com> - 1.0.1
2
+ - Update ServerGroup to call init in all methods. Fixes NilClass errors
3
+ which can occur if you don't explicitly call 'group::init' in rake tasks.
4
+ - XenServer: Automatically add IP to bridge.
5
+
6
+ * Sun Jul 22 2012 Dan Prince <dprince@redhat.com> - 1.0.0
7
+ - Initial release. Based on Chef VCP Toolkit.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -1,9 +1,8 @@
1
1
  require 'json'
2
- require 'builder'
3
2
  require 'fileutils'
4
- require 'rexml/document'
5
3
  require 'kytoon/util'
6
4
  require 'base64'
5
+ require 'ipaddr'
7
6
 
8
7
  module Kytoon
9
8
 
@@ -229,18 +228,30 @@ fi
229
228
 
230
229
  def self.init_host(sg)
231
230
 
231
+ cidr = IPAddr.new(sg.netmask).to_i.to_s(2).count("1")
232
+
232
233
  hosts_file_data = "127.0.0.1\tlocalhost localhost.localdomain\n"
233
234
  sg.servers.each do |server|
234
235
  hosts_file_data += "#{server['ip_address']}\t#{server['hostname']}\n"
235
236
  end
236
237
 
237
238
  Kytoon::Util.remote_exec(%{
239
+ # Add first IP to bridge
240
+ if ! ip a | grep #{sg.gateway}/#{cidr} | grep #{sg.bridge}; then
241
+ ip a add #{sg.gateway}/#{cidr} dev #{sg.bridge}
242
+ fi
243
+
238
244
  cat > /etc/hosts <<-EOF_CAT
239
245
  #{hosts_file_data}
240
246
  EOF_CAT
241
247
  # FIXME... probably a bit insecure but most people are probably using
242
248
  # boxes behind another firewall anyway.
243
249
  iptables -F
250
+ iptables -X
251
+ iptables -t nat -F
252
+ iptables -t nat -X
253
+ iptables -t mangle -F
254
+ iptables -t mangle -X
244
255
  iptables -P INPUT ACCEPT
245
256
  iptables -P FORWARD ACCEPT
246
257
  iptables -P OUTPUT ACCEPT
@@ -20,10 +20,12 @@ class ServerGroup
20
20
  end
21
21
 
22
22
  def self.index(options)
23
+ self.init
23
24
  @@group_class.index(options)
24
25
  end
25
26
 
26
27
  def self.create
28
+ self.init
27
29
  json_config_file=ENV['SERVER_GROUP_JSON']
28
30
  if json_config_file.nil? then
29
31
  json_config_file = @@group_class::CONFIG_FILE
@@ -33,11 +35,13 @@ class ServerGroup
33
35
  end
34
36
 
35
37
  def self.get
38
+ self.init
36
39
  id = ENV['GROUP_ID']
37
40
  @@group_class.get(:id => id)
38
41
  end
39
42
 
40
43
  def self.delete
44
+ self.init
41
45
  id = ENV['GROUP_ID']
42
46
  sg = @@group_class.get(:id => id)
43
47
  sg.delete
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kytoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -181,6 +181,7 @@ extra_rdoc_files:
181
181
  - README.rdoc
182
182
  files:
183
183
  - .document
184
+ - CHANGELOG
184
185
  - Gemfile
185
186
  - Gemfile.lock
186
187
  - LICENSE.txt
@@ -231,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
232
  version: '0'
232
233
  segments:
233
234
  - 0
234
- hash: 1256682396353941801
235
+ hash: -3839529806492560210
235
236
  required_rubygems_version: !ruby/object:Gem::Requirement
236
237
  none: false
237
238
  requirements: