staypuft 0.5.2 → 0.5.3

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
- YzJhYzdmNWIxZTJmZjYwZmMzZTRiY2NmY2EzNjY0MzRjYjc1NWQ5Nw==
4
+ ZGUyNWNiM2M0NjZkMTZiMDRiN2ExNjdmNTEzYTU3MDQwY2EzYThlZQ==
5
5
  data.tar.gz: !binary |-
6
- MjJiZTgxMWZkNjY4YjI3N2EzOGE1MjYxOGY3ZGUyM2U4NmI3Y2I1Yw==
6
+ NzI0ZTY4Y2UzZGM3MzI2MTU3OTkzMjE0NTU5MmVlMmM5YzU5MTYyMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2Y0ZWU4NDUzMDg3MDA2ZTQzODNlMzE4MmMzNGZlODY0MDI3NTkyZTcwNTlj
10
- Mzg2OWNiYjBmNjRlZDVlNWFjZGRiYjQyY2YzMzRjZTM4MGEwYjFkYjMxMmFi
11
- MWE2ZTI4YjUyOTI2Yzk4MzJjNGMzNWRlY2Y5ODQ2Mzk4MGIzOGY=
9
+ NTEzNjU2YzIyY2JiNDc1MTYzNGZhYzBlNjFkZGI4ZGI5YmY1YTc3MTdjMDBj
10
+ MTJmZTExNjMwZjZkNGRkMWUzZTM1NzJkZDZkMmRmMWQzZjIxNTI2MWJhZTlk
11
+ ODU4MWJlYjk5ODEyZTZkM2IzNTBlZGE2ZDc5ZGJhNmMwMTgyYjY=
12
12
  data.tar.gz: !binary |-
13
- ZDZlMDQwY2M4MTUxNzk4NmY2ZDAzOTVkZGQ0NGZlYTgxNzM2ZTY5NzUwYTBj
14
- NTRkMjY4ZTVkNWMxOWZlMDRlYzkzZmUzN2U3ZTY5MjQzNGQ0MmFjMGRmOWQ5
15
- ZTA2OGYxNjM2MjNiOTNlNTlhM2M4YTRhMTE3MjllODFiMTcwNTU=
13
+ MmRlYTkyMDkyOTY1MWViYzgyNDliNzM5ZTdhODYxMmU5NzYwMTE2NGIxYWI2
14
+ M2JlNGNlZjRhOWI4MTY5MWMwN2ZkMzcwODdlNmJlZTQwYmQxOTA5MjRjZTdh
15
+ Y2UxNmZiYzZhNzlhYWQ3NWQxN2YwMmIzMjI1YWI4ZTg0YWZiMWQ=
@@ -31,10 +31,15 @@ module Staypuft
31
31
  HUMAN = N_('NFS URI:')
32
32
  HUMAN_AFTER = Deployment::GlanceService::NFS_HELP
33
33
  end
34
+
35
+ class NfsUriValueValidator < ActiveModel::EachValidator
36
+ include Staypuft::Deployment::NfsUriValidator
37
+ end
38
+
34
39
  validates :nfs_uri,
35
- :presence => true,
36
- :if => :nfs_backend?
37
- # TODO: uri validation
40
+ :presence => true,
41
+ :if => :nfs_backend?,
42
+ :nfs_uri_value => true
38
43
 
39
44
  module SanIp
40
45
  HUMAN = N_('SAN IP Addr:')
@@ -28,10 +28,14 @@ module Staypuft
28
28
  HUMAN_AFTER = NFS_HELP
29
29
  end
30
30
 
31
+ class NfsNetworkPathValueValidator < ActiveModel::EachValidator
32
+ include Staypuft::Deployment::NfsUriValidator
33
+ end
34
+
31
35
  validates :nfs_network_path,
32
- :presence => true,
33
- :if => :nfs_backend?
34
- # TODO: network_path validation
36
+ :presence => true,
37
+ :if => :nfs_backend?,
38
+ :nfs_network_path_value => true
35
39
 
36
40
  class Jail < Safemode::Jail
37
41
  allow :driver_backend, :pcmk_fs_type, :pcmk_fs_device, :pcmk_fs_options, :backend,
@@ -1,30 +1,10 @@
1
1
  module Staypuft
2
2
  module Deployment::IpAddressValidator
3
- NOT_RANGE_MSG = N_("Specify single IP address, not range")
4
- INVALID_IP_OR_FQDN_MSG = N_("Invalid IP address or FQDN supplied")
3
+ include Staypuft::Deployment::IpCheck
5
4
 
6
5
  def validate_each(record, attribute, value)
7
6
  return if value.empty?
8
-
9
- begin
10
- ip_addr = IPAddr.new(value)
11
- ip_range = ip_addr.to_range
12
- if ip_range.begin == ip_range.end
13
- true
14
- else
15
- record.errors.add attribute, NOT_RANGE_MSG
16
- false
17
- end
18
- rescue
19
- # not IP addr
20
- # validating as fqdn
21
- if /(?=^.{1,254}$)(^(((?!-)[a-zA-Z0-9-]{1,63}(?<!-))|((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63})$)/ =~ value
22
- true
23
- else
24
- record.errors.add attribute, INVALID_IP_OR_FQDN_MSG
25
- false
26
- end
27
- end
7
+ check_ip_or_hostname(record, attribute, value)
28
8
  end
29
9
  end
30
10
  end
@@ -0,0 +1,28 @@
1
+ module Staypuft
2
+ module Deployment::IpCheck
3
+ NOT_RANGE_MSG = N_("Specify single IP address, not range")
4
+ INVALID_IP_OR_FQDN_MSG = N_("Invalid IP address or FQDN supplied")
5
+
6
+ def check_ip_or_hostname(record, attribute, value)
7
+ begin
8
+ ip_addr = IPAddr.new(value)
9
+ ip_range = ip_addr.to_range
10
+ if ip_range.begin == ip_range.end
11
+ true
12
+ else
13
+ record.errors.add attribute, NOT_RANGE_MSG
14
+ false
15
+ end
16
+ rescue
17
+ # not IP addr
18
+ # validating as fqdn
19
+ if /(?=^.{1,254}$)(^(((?!-)[a-zA-Z0-9-]{1,63}(?<!-))|((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63})$)/ =~ value
20
+ true
21
+ else
22
+ record.errors.add attribute, INVALID_IP_OR_FQDN_MSG
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ module Staypuft
2
+ module Deployment::NfsUriValidator
3
+ include Staypuft::Deployment::IpCheck
4
+
5
+ INVALID_URI_MESSAGE = N_('Specify NFS URI as &lt;server&gt;:&lt;local path&gt;')
6
+ def validate_each(record, attribute, value)
7
+ return if value.empty?
8
+ match = /(.+):(.+)/.match(value)
9
+ if match
10
+ check_ip_or_hostname(record, attribute, match[1])
11
+ else
12
+ record.errors.add attribute, INVALID_URI_MESSAGE
13
+ false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -8,12 +8,12 @@
8
8
  <% @deployment.child_hostgroups.deploy_order.each_with_index do |child_hostgroup, i| %>
9
9
  <li>
10
10
  <div class="col-xs-2">
11
- <% if child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed? }.count > 0 %>
11
+ <% if child_hostgroup.hosts.select { |h| !@deployment.in_progress? && h.open_stack_deployed? }.count > 0 %>
12
12
  <a href="#<%= child_hostgroup.name.parameterize.underscore %>_deployed_hosts" data-toggle="tab" class="roles_list">
13
- <span><%= child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed? }.count %></span>
13
+ <span><%= child_hostgroup.hosts.select { |h| !@deployment.in_progress? && h.open_stack_deployed? }.count %></span>
14
14
  </a>
15
15
  <% else %>
16
- <span><%= child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed? }.count %></span>
16
+ <span><%= child_hostgroup.hosts.select { |h| !@deployment.in_progress? && h.open_stack_deployed? }.count %></span>
17
17
  <% end %>
18
18
  </div>
19
19
  <div class="col-xs-6">
@@ -22,14 +22,14 @@
22
22
  </div>
23
23
  </div>
24
24
  <div class="col-xs-2">
25
- <% if child_hostgroup.hosts.select { |h| !(!ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed?) }.count > 0 %>
25
+ <% if child_hostgroup.hosts.select { |h| !(!@deployment.in_progress? && h.open_stack_deployed?) }.count > 0 %>
26
26
  <a href="#<%= child_hostgroup.name.parameterize.underscore %>_assigned_hosts" data-toggle="tab" class="roles_list">
27
- <% unless @deployment.in_progress? %>
28
- <i class="glyphicon glyphicon-time"></i>
29
- <% else %>
27
+ <% if child_hostgroup.hosts.select { |h| (@deployment.in_progress? && h.open_stack_deployed?) }.count > 0 %>
30
28
  <%= image_tag '/assets/spinner.gif' %>
29
+ <% else %>
30
+ <i class="glyphicon glyphicon-time"></i>
31
31
  <% end %>
32
- <span><%= child_hostgroup.hosts.select { |h| !(!ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed?) }.count %></span>
32
+ <span><%= child_hostgroup.hosts.select { |h| !(!@deployment.in_progress? && h.open_stack_deployed?) }.count %></span>
33
33
  </a>
34
34
  <% end %>
35
35
  </div>
@@ -55,7 +55,7 @@
55
55
  <%= render 'deployed_hosts_table', :deployment => @deployment,
56
56
  :hostgroup => @hostgroup,
57
57
  :child_hostgroup => child_hostgroup,
58
- :hosts => child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed? } %>
58
+ :hosts => child_hostgroup.hosts.select { |h| !@deployment.in_progress? && h.open_stack_deployed? } %>
59
59
  <% end %>
60
60
  <%= render :partial => "deployment_summary", :locals => { :deployment => @deployment } %>
61
61
  </div>
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
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.5.2
4
+ version: 0.5.3
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-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks
@@ -160,8 +160,10 @@ files:
160
160
  - app/models/staypuft/deployment/cinder_service/equallogic.rb
161
161
  - app/models/staypuft/deployment/glance_service.rb
162
162
  - app/models/staypuft/deployment/ip_address_validator.rb
163
+ - app/models/staypuft/deployment/ip_check.rb
163
164
  - app/models/staypuft/deployment/neutron_service.rb
164
165
  - app/models/staypuft/deployment/neutron_service/cisconexus.rb
166
+ - app/models/staypuft/deployment/nfs_uri_validator.rb
165
167
  - app/models/staypuft/deployment/nova_service.rb
166
168
  - app/models/staypuft/deployment/passwords.rb
167
169
  - app/models/staypuft/deployment/vlan_range_values_validator.rb