staypuft 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDMxMmJlMWYzNTNkM2ZiZDdlZjQ3ODllNjAxNTYxOTM2OWU0ZDRlNA==
4
+ NzQ3MmEzM2QyZmU1YmJhYzkxYjY2NWNhZWE5NGE3ZjNhY2M3Zjk2MQ==
5
5
  data.tar.gz: !binary |-
6
- NzQ4ZmMzNmMzMGM0NTZmMWZmZDNhNTE4NWNkNTJmZmI0MmZkM2FmNg==
6
+ MmQxYjQ4MmI4YTAzMjYwMmIwOWYwZGU2ZDZjMmIzOTQwMjkxNmYwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2E4MGMxMjY4N2ViMjc3NzBkYWM1ZTJkYmY0N2Q4ODQ1YjM1MTc4ZTcxZmE3
10
- ZWQzOGRmOTgzZmQ5YjhmM2ZlOTc2NWM4NDhjMzE5ODg2MTI0MTk3NTU5MTVl
11
- MGIyYzcyMzY5ODk0ZDMzMmViMWEzYzI3NTM3Y2NjZWE4ODk4ZTc=
9
+ OGJlYjI5MmRkYjE5MDBlMTEwNWIwNzdlYmUyOTU4NTNkOGQ4MDgxNzJiNDc3
10
+ OGU2YzQ1NjBiNjMxMmYzMWVhNWNmYWFhN2E4YjEwYzUwN2FiYmYyZGY1ODU3
11
+ ZmJlNzBiZWU5ODZkMWU4YzBmMjA2OWRkYTE4ZDU1YWY1MjlmZWE=
12
12
  data.tar.gz: !binary |-
13
- NDQwYTczZmI5NDI5M2Q5NmM1MWZlODk3Njc2YmVhMGU4MzgzM2Y1MTVkM2U1
14
- NTZjNDE0NmY0MGM0NTE5YmIyYmI3MWMwNTVmOWYxODVlOGRlZmE3MTJjNDAy
15
- NmNhYWZkMGQxZjM2MTNkNTU5MTMxMzdjNjkwZGM5MDhjYzc2MWU=
13
+ NGMwZjBjMjM0MWFmOWI5NzA3ZDczYzgzNmNmMmI1MWQzMmJjNTk5YzMyNTM2
14
+ YzMxZTcwZTJmOWYzYjQ4ZDA0NmE4OTJjZjdjOWI5YmI0NzRlZTUwM2E4MGZj
15
+ M2ViMDY3YmQ2ZTJhYmU1M2UyODQyOTA5NjI1YTE3OTJiMWYyNjk=
@@ -7,6 +7,7 @@ module Staypuft
7
7
  @subnet = Subnet.find(params[:subnet_id])
8
8
  check_for_existing_assignments
9
9
  check_for_ip_management
10
+ check_public_api_for_default_gateway
10
11
  check_for_unsharable_subnet_types
11
12
  @subnet_typing = @deployment.subnet_typings.new(:subnet_id => @subnet.id, :subnet_type_id => @subnet_type.id)
12
13
  @saved = @errors.blank? ? @subnet_typing.save : false
@@ -20,6 +21,7 @@ module Staypuft
20
21
  @subnet = Subnet.find(params[:subnet_id])
21
22
  check_for_existing_assignments
22
23
  check_for_ip_management
24
+ check_public_api_for_default_gateway
23
25
  check_for_unsharable_subnet_types
24
26
  @subnet_typing.subnet = @subnet
25
27
  @saved = @errors.blank? ? @subnet_typing.save : false
@@ -63,7 +65,7 @@ module Staypuft
63
65
  def check_for_unsharable_subnet_types
64
66
  # if subnet type is unsharable, make sure nothing else is already assigned here
65
67
  if @subnet_type.dedicated_subnet
66
- if @deployment.subnet_typings.where(:subnet_id => @subnet.id).size > 0
68
+ if @deployment.subnet_typings.where(:subnet_id => @subnet.id).size > 0
67
69
  @errors[@subnet_type.name] = ["Subnet cannot be shared with other traffic types in this deployment."]
68
70
  false
69
71
  else
@@ -72,7 +74,7 @@ module Staypuft
72
74
  #otherwise make sure there's no existing unsharable type already here
73
75
  else
74
76
  existing_dedicated_types = @deployment.subnet_typings.includes(:subnet_type).where(:subnet_id => @subnet.id, "staypuft_subnet_types.dedicated_subnet" => true)
75
- if existing_dedicated_types.size > 0
77
+ if existing_dedicated_types.size > 0
76
78
  @errors[existing_dedicated_types.first.subnet_type.name] = ["Subnet cannot be shared with other traffic types in this deployment."]
77
79
  false
78
80
  else
@@ -80,5 +82,11 @@ module Staypuft
80
82
  end
81
83
  end
82
84
  end
85
+
86
+ def check_public_api_for_default_gateway
87
+ if @subnet_type.name == Staypuft::SubnetType::PUBLIC_API && @subnet.gateway.empty?
88
+ @errors[@subnet_type.name] = ["Subnet must have a default gateway defined."]
89
+ end
90
+ end
83
91
  end
84
92
  end
@@ -7,5 +7,5 @@ end
7
7
 
8
8
  Deface::Override.new(:virtual_path => "nic/_base_form",
9
9
  :name => "add_network_types_to_subnet",
10
- :replace => "erb[loud]:contains(':subnet_id')",
10
+ :replace => "#{erb_tag}:contains(':subnet_id')",
11
11
  :template => "nic/_subnet_id_field")
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.4.7'
2
+ VERSION = '0.4.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staypuft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Staypuft team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-20 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks