staypuft 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yjg1MTI2NjJmZTBiYWRjYmM2MjBjM2U3MDNhZjEzZjFmYTI4MjBjYw==
4
+ MDMxMmJlMWYzNTNkM2ZiZDdlZjQ3ODllNjAxNTYxOTM2OWU0ZDRlNA==
5
5
  data.tar.gz: !binary |-
6
- NTI5ZmJlODZlNDI5ZWUxOGIwNjJjM2Y5YzRkNzM4ZGFjOTEyYTNlOQ==
6
+ NzQ4ZmMzNmMzMGM0NTZmMWZmZDNhNTE4NWNkNTJmZmI0MmZkM2FmNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmVjNTRlNmNhY2Q4NjI0OThkNGZmZmY4OTllMTNjNTlhNzJjNzBiNDNmNGY2
10
- YTA0Y2NkNmJhMmJlMTZiNGI4NTYzYjNkOGZkNDg2ODFmNjM0ZGZjNTRhOTBj
11
- YTFiM2YyZTI0ZjBjM2FlZmMxM2VkZTgyODU1ODNmMGIwMzRlNDQ=
9
+ N2E4MGMxMjY4N2ViMjc3NzBkYWM1ZTJkYmY0N2Q4ODQ1YjM1MTc4ZTcxZmE3
10
+ ZWQzOGRmOTgzZmQ5YjhmM2ZlOTc2NWM4NDhjMzE5ODg2MTI0MTk3NTU5MTVl
11
+ MGIyYzcyMzY5ODk0ZDMzMmViMWEzYzI3NTM3Y2NjZWE4ODk4ZTc=
12
12
  data.tar.gz: !binary |-
13
- YjA5MTExY2QyZjUxMGY0Mjk4ZWNmZWQ2MDUxODhkZGU4YmU3YzJjNTE1NTVj
14
- N2RlY2NiZDc1MmZkMDQ4NTFjNTI3ZDcwZGYzNTZmM2YzZmJhNDU5NjA4MGVh
15
- MTFiNjAzZGFjZmU2MTgxNzIxNmI2M2E4YWU4ZWY2ZGE5ODkxZmY=
13
+ NDQwYTczZmI5NDI5M2Q5NmM1MWZlODk3Njc2YmVhMGU4MzgzM2Y1MTVkM2U1
14
+ NTZjNDE0NmY0MGM0NTE5YmIyYmI3MWMwNTVmOWYxODVlOGRlZmE3MTJjNDAy
15
+ NmNhYWZkMGQxZjM2MTNkNTU5MTMxMzdjNjkwZGM5MDhjYzc2MWU=
@@ -2,16 +2,18 @@ module Staypuft::Concerns::HostsApiExtensions
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- prepend_before_filter :check_openstack_hostgroup, only: [:create, :update]
5
+ before_filter :check_openstack_hostgroup, only: [:create, :update]
6
6
  end
7
7
 
8
8
  def check_openstack_hostgroup
9
9
  if params[:host] and params[:host][:hostgroup_id]
10
10
  hostgroup_id = params[:host][:hostgroup_id]
11
11
  hg = Hostgroup.find(hostgroup_id)
12
- if hg.ancestors.include? Hostgroup.get_base_hostgroup
13
- Rails.logger.error "Cannot set a deployment hostgroup directly."
14
- render :json => {:error => {:message => _('Cannot set a deployment hostgroup directly.') } }, :status => :forbidden
12
+ unless @host.deployment and @host.hostgroup == hg
13
+ if hg.ancestors.include? Hostgroup.get_base_hostgroup
14
+ Rails.logger.error "Cannot set a deployment hostgroup directly."
15
+ render :json => {:error => _('Cannot set a deployment hostgroup directly.') }, :status => :forbidden
16
+ end
15
17
  end
16
18
  end
17
19
  end
@@ -9,10 +9,13 @@ module Staypuft::Concerns::HostsControllerExtensions
9
9
  def check_openstack_hostgroup
10
10
  if params[:host] and params[:host][:hostgroup_id]
11
11
  hostgroup_id = params[:host][:hostgroup_id]
12
- if openstack_hostgroup? hostgroup_id
13
- Rails.logger.error "Cannot set a deployment hostgroup directly."
14
- error _('Invalid host group selected! Cannot select OpenStack deployment host group.')
15
- render :action => :edit and return
12
+ hostgroup = Hostgroup.find(hostgroup_id)
13
+ unless hostgroup.deployment and @host.hostgroup == hostgroup
14
+ if openstack_hostgroup? hostgroup_id
15
+ Rails.logger.error "Cannot set a deployment hostgroup directly."
16
+ error _('Invalid host group selected! Cannot select OpenStack deployment host group.')
17
+ render :action => :edit and return
18
+ end
16
19
  end
17
20
  end
18
21
  end
@@ -23,6 +23,7 @@ module Staypuft
23
23
 
24
24
  if errors.present?
25
25
  flash[:error] = errors.map{ |k, v| "#{k}: #{v}" }.join('<br />')
26
+ render :js => "$('#configure_networks_modal').modal('hide'); window.location = '#{deployment_path(@deployment)}'"
26
27
  end
27
28
  end
28
29
 
@@ -28,7 +28,8 @@ Deface::Override.new(:virtual_path => "hosts/_form",
28
28
  :replace => "#{erb_tag}:contains(':hostgroup_id')",
29
29
  :original => '04903c858c6f96ed5c015cac5960e02708d8fea8'
30
30
  ) do
31
- " <%= select_f f, :hostgroup_id, accessible_hostgroups.reject { |hg| hg.to_label =~ /\#{Setting[:base_hostgroup]}\\/.*/ }, :id, :to_label,
31
+ " <% hostgroups = accessible_hostgroups.reject { |hg| hg.to_label =~ /\#{Setting[:base_hostgroup]}\\/.*/ && hg.to_label != @host.hostgroup.to_label } %>
32
+ <%= select_f f, :hostgroup_id, hostgroups, :id, :to_label,
32
33
  { :include_blank => true},
33
34
  { :onchange => 'hostgroup_changed(this);', :'data-host-id' => @host.id,
34
35
  :'data-url' => (@host.new_record? || @host.type_changed?) ? process_hostgroup_hosts_path : hostgroup_or_environment_selected_hosts_path,
@@ -10,6 +10,7 @@ Deface::Override.new(:virtual_path => "hosts/select_multiple_hostgroup",
10
10
  :replace => "#{erb_tag}:contains(':id')",
11
11
  :original => '<%= selectable_f f, :id, [[_("Select host group"),"disabled"],[_("*Clear host group*"), "" ]] + Hostgroup.all.map{|h| [h.to_label, h.id]}.sort,{}, :onchange => "toggle_multiple_ok_button(this)" %>'
12
12
  ) do
13
- " <%= selectable_f f, :id, [[_(\"Select host group\"),\"disabled\"],[_(\"*Clear host group*\"), \"\" ]] + Hostgroup.all.reject{ |hg| hg.to_label =~ /\#{Setting[:base_hostgroup]}\\/.*/ }.map{|h| [h.to_label, h.id]}.sort,{},
13
+ " <% hostgroups = accessible_hostgroups.reject { |hg| hg.to_label =~ /\#{Setting[:base_hostgroup]}\\/.*/ } %>
14
+ <%= selectable_f f, :id, [[_(\"Select host group\"),\"disabled\"],[_(\"*Clear host group*\"), \"\" ]] + hostgroups.map{|h| [h.to_label, h.id]}.sort,{},
14
15
  :onchange => \"toggle_multiple_ok_button(this)\" %>"
15
16
  end
@@ -5,7 +5,7 @@
5
5
  <div class="panel-body">
6
6
  <% @subnets.each do |subnet| %>
7
7
  <% next if is_pxe?(@deployment, subnet) # we skip PXE network which is always on primary interface %>
8
- <% next if @host.interfaces.vip.where(:subnet_id => subnet.id).present? # we skip assigned subnets %>
8
+ <% next if @host.interfaces.non_vip.where(:subnet_id => subnet.id).present? # we skip assigned subnets %>
9
9
  <%= render 'staypuft/subnets/subnet_pull',
10
10
  :subnet => subnet,
11
11
  :deployment => @deployment,
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.4.6'
2
+ VERSION = '0.4.7'
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.6
4
+ version: 0.4.7
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-17 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks