staypuft 0.3.4 → 0.3.5

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb78ba28b433c78bd8f8d9a1f0cc5a4c4cc185a6
4
- data.tar.gz: 0eb3ff52a83c0fa63e4dee33dfc37c2e6eeffeef
3
+ metadata.gz: 8fdb7f5ba17853a2b098fcf45e3a0a9798a92e1e
4
+ data.tar.gz: ade7196f14eac31b51265ade7c16c13f4a7db384
5
5
  SHA512:
6
- metadata.gz: 959238ed73d99ddda11f7e4257a5163e12fccb6e9b42d31aeeda6d0eb746de40845305972a2003696d4838f3537a976f4b538861d7761a5b9995c195520f2b8b
7
- data.tar.gz: 1632029a27cdc779f060aaf6f026cebcca45521620e83e3de78835fe2ddb58575e611387e3a63df8557ef4eccc9b111d5b5f13de2ed0226dda6ed3f6e8382e87
6
+ metadata.gz: 055e98568db7d185ccc3d92013a7c59931b3b8602e4daa414af70091096557d805e2df95fb16baa0a437b4a23770354d3b4f400cf370ee45e1cc597ebd6c77be
7
+ data.tar.gz: 1f140055e26614e19ab63d42897f76ed04691fe724821e8bdb7c49863a4abedd5dff64e1697c98ba4a2e62d4293b718a457af653a9e719731160f2116420d6ed
@@ -1,3 +1,11 @@
1
+ function find_network_interface_field(fieldset, field, html_input_type) {
2
+ label = fieldset.find("label[for='" + field + "']");
3
+ html_input = label.parent().find(html_input_type);
4
+
5
+ return html_input;
6
+ };
7
+
8
+
1
9
  $(document).ready(function() {
2
10
  update_fencing_form();
3
11
  // NOTE: setTimeout is required to make sure this code runs after all event
@@ -55,23 +63,8 @@ function override_ajax_submit() {
55
63
  });
56
64
  };
57
65
 
58
- $(document).on('change', 'fieldset#interface', function() { update_fencing_form(); });
59
- $(document).on('change', '#fencing', function() { update_bmc_interface_form(); });
60
-
61
- function get_value_from_network_interface_form(fieldset, field, html_input_type) {
62
- label = fieldset.find("label[for='" + field + "']");
63
- html_input = label.parent().find(html_input_type);
64
-
65
- return html_input;
66
- };
67
-
68
- function get_bmc_interface_form() {
69
- return $('fieldset#interface').filter(function(index, fieldset){
70
- type = get_value_from_network_interface_form($(fieldset), 'type', 'select');
71
- return type.val() == 'Nic::BMC';
72
- });
73
- }
74
66
 
67
+ $(document).on('change', 'fieldset#interface', function() { update_fencing_form(); });
75
68
  function update_fencing_form() {
76
69
  bmc_fieldset = get_bmc_interface_form();
77
70
  if (bmc_fieldset.length == 0) {
@@ -81,34 +74,68 @@ function update_fencing_form() {
81
74
  enable_fencing_form();
82
75
  }
83
76
 
84
- selected_provider = get_value_from_network_interface_form(bmc_fieldset, 'provider', 'select');
77
+ selected_provider = find_network_interface_field(bmc_fieldset, 'provider', 'select');
85
78
 
86
- ip = get_value_from_network_interface_form(bmc_fieldset, 'ip', 'input').val();
79
+ ip = find_network_interface_field(bmc_fieldset, 'ip', 'input').val();
87
80
  $('#host_fencing_attrs_fence_ipmilan_address').val(ip);
88
- username = get_value_from_network_interface_form(bmc_fieldset, 'username', 'input').val();
81
+ username = find_network_interface_field(bmc_fieldset, 'username', 'input').val();
89
82
  $('#host_fencing_attrs_fence_ipmilan_username').val(username);
90
- password = get_value_from_network_interface_form(bmc_fieldset, 'password', 'input').val();
83
+ password = find_network_interface_field(bmc_fieldset, 'password', 'input').val();
91
84
  $('#host_fencing_attrs_fence_ipmilan_password').val(password);
92
85
  };
93
86
 
87
+ function disable_fencing_form() {
88
+ $('#fencing_form').hide();
89
+ $('#fencing_disabled_notice').show();
90
+ };
91
+
92
+ function enable_fencing_form() {
93
+ $('#fencing_disabled_notice').hide();
94
+ $('#fencing_form').show();
95
+ };
96
+
97
+
98
+ $(document).on('change', '#fencing', function() { update_bmc_interface_form(); });
94
99
  function update_bmc_interface_form() {
95
100
  bmc_fieldset = get_bmc_interface_form();
96
- selected_provider = get_value_from_network_interface_form(bmc_fieldset, 'provider', 'select');
101
+ selected_provider = find_network_interface_field(bmc_fieldset, 'provider', 'select');
97
102
 
98
103
  ip = $('#host_fencing_attrs_fence_ipmilan_address').val();
99
- get_value_from_network_interface_form(bmc_fieldset, 'ip', 'input').val(ip);
104
+ find_network_interface_field(bmc_fieldset, 'ip', 'input').val(ip);
100
105
  username = $('#host_fencing_attrs_fence_ipmilan_username').val();
101
- get_value_from_network_interface_form(bmc_fieldset, 'username', 'input').val(username);
106
+ find_network_interface_field(bmc_fieldset, 'username', 'input').val(username);
102
107
  password = $('#host_fencing_attrs_fence_ipmilan_password').val();
103
- get_value_from_network_interface_form(bmc_fieldset, 'password', 'input').val(password);
108
+ find_network_interface_field(bmc_fieldset, 'password', 'input').val(password);
104
109
  };
105
110
 
106
- function disable_fencing_form() {
107
- $('#fencing_form').hide();
108
- $('#fencing_disabled_notice').show();
111
+ function get_bmc_interface_form() {
112
+ return $('fieldset#interface').filter(function(index, fieldset){
113
+ type = find_network_interface_field($(fieldset), 'type', 'select');
114
+ return type.val() == 'Nic::BMC';
115
+ });
109
116
  };
110
117
 
111
- function enable_fencing_form() {
112
- $('#fencing_disabled_notice').hide();
113
- $('#fencing_form').show();
118
+
119
+ $(document).ready(function() {
120
+ $('fieldset#interface').each(function(idx, fieldset) {
121
+ update_subnet_types(fieldset);
122
+ });
123
+ });
124
+
125
+ $(document).on('change', 'fieldset#interface select.interface_subnet', function(event) {
126
+ fieldset = $(event.target).parents('fieldset#interface');
127
+ update_subnet_types(fieldset);
128
+ });
129
+ function update_subnet_types(fieldset) {
130
+ subnet_select = find_network_interface_field($(fieldset), 'subnet_id', 'select');
131
+ subnet_types = subnet_select.data('types');
132
+ help_message = subnet_types[subnet_select.val()];
133
+
134
+ if (!help_message || help_message == '') {
135
+ subnet_select.parent().next().empty();
136
+ return;
137
+ }
138
+
139
+ subnet_select.parent().next().empty().append(
140
+ '<div><i class="glyphicon glyphicon-info-sign" /> ' + help_message + '</div>');
114
141
  };
@@ -0,0 +1,17 @@
1
+ module Staypuft
2
+ module HostsHelper
3
+
4
+ def list_subnet_types(nic, subnets)
5
+ types = {}
6
+
7
+ return types if nic.host.nil? || nic.host.deployment.nil?
8
+
9
+ subnets.each do |subnet|
10
+ types[subnet.id] = subnet_types(nic.host.deployment, subnet)
11
+ end
12
+
13
+ return types
14
+ end
15
+
16
+ end
17
+ end
@@ -236,7 +236,7 @@ module Staypuft
236
236
  ml2_tenant_network_types = [ tenant_network_type ]
237
237
  ml2_tunnel_id_ranges = ['10:1000']
238
238
  ml2_vni_ranges = ['10:1000']
239
- ovs_tunnel_types = ['vxlan', 'gre']
239
+ ovs_tunnel_types = { :array => '<%= @host.deployment.neutron.ovs_tunnel_types %>' }
240
240
  ovs_tunnel_iface = { :string => '<%= n = @host.deployment.neutron; n.enable_tunneling? ? n.tenant_iface(@host) : "" %>' }
241
241
  ovs_bridge_mappings = { :array => '<%= @host.deployment.neutron.networker_ovs_bridge_mappings(@host) %>' }
242
242
  ovs_bridge_uplinks = { :array => '<%= @host.deployment.neutron.networker_ovs_bridge_uplinks(@host) %>' }
@@ -359,9 +359,9 @@ module Staypuft
359
359
  fence_ipmilan_address = { :string => '<%= @host.bmc_nic.ip if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
360
360
  fence_ipmilan_username = { :string => '<%= @host.bmc_nic.username if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
361
361
  fence_ipmilan_password = { :string => '<%= @host.bmc_nic.password if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
362
- fence_ipmilan_interval = { :string => '<%= "60s" if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
363
- fence_ipmilan_hostlist = { :string => '<%= "" if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
364
- fence_ipmilan_host_to_address = { :array => '<%= [] if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
362
+ fence_ipmilan_interval = '60s'
363
+ fence_ipmilan_hostlist = ''
364
+ fence_ipmilan_host_to_address = []
365
365
  fence_ipmilan_expose_lanplus = { :string => '<%= @host.bmc_nic.expose_lanplus? if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
366
366
  fence_ipmilan_lanplus_options = { :string => '<%= @host.bmc_nic.attrs["fence_ipmilan_lanplus_options"] if @host.bmc_nic && @host.bmc_nic.fencing_enabled? %>' }
367
367
 
@@ -54,7 +54,8 @@ module Staypuft
54
54
  validates :eqlxs,
55
55
  :presence => true,
56
56
  :if => :equallogic_backend?
57
- validate :equallogic_backends
57
+ validate :equallogic_backends,
58
+ :if => :equallogic_backend?
58
59
 
59
60
  class Jail < Safemode::Jail
60
61
  allow :lvm_backend?, :nfs_backend?, :ceph_backend?, :equallogic_backend?,
@@ -41,7 +41,7 @@ module Staypuft
41
41
  class Jail < Safemode::Jail
42
42
  allow :networker_vlan_ranges, :compute_vlan_ranges, :network_segmentation, :enable_tunneling?,
43
43
  :tenant_iface, :networker_ovs_bridge_mappings, :networker_ovs_bridge_uplinks,
44
- :compute_ovs_bridge_mappings, :compute_ovs_bridge_uplinks
44
+ :compute_ovs_bridge_mappings, :compute_ovs_bridge_uplinks, :ovs_tunnel_types
45
45
  end
46
46
 
47
47
  def set_defaults
@@ -98,6 +98,17 @@ module Staypuft
98
98
  deployment.network_query.interface_for_host(host, Staypuft::SubnetType::EXTERNAL)
99
99
  end
100
100
 
101
+ def ovs_tunnel_types
102
+ case network_segmentation
103
+ when NetworkSegmentation::VXLAN
104
+ ['vxlan']
105
+ when NetworkSegmentation::GRE
106
+ ['gre']
107
+ else
108
+ []
109
+ end
110
+ end
111
+
101
112
  def param_hash
102
113
  { 'network_segmentation' => network_segmentation,
103
114
  'tenant_vlan_ranges' => tenant_vlan_ranges }
@@ -0,0 +1,11 @@
1
+ # older deface requires code prefix for erb tags
2
+ if Gem.loaded_specs['deface'].version >= Gem::Version.new('1.0.0')
3
+ erb_tag = 'erb[loud]'
4
+ else
5
+ erb_tag = 'code[erb-loud]'
6
+ end
7
+
8
+ Deface::Override.new(:virtual_path => "nic/_base_form",
9
+ :name => "add_network_types_to_subnet",
10
+ :replace => "erb[loud]:contains(':subnet_id')",
11
+ :template => "nic/_subnet_id_field")
@@ -0,0 +1,7 @@
1
+ <%= select_f f, :subnet_id, accessible_subnets, :id, :to_label,
2
+ { :include_blank => accessible_subnets.any? ? true : _("No subnets")},
3
+ { :disabled => accessible_subnets.empty? ? true : false,
4
+ :help_inline => 'help_inline',
5
+ :class => 'interface_subnet',
6
+ 'data-url' => freeip_subnets_path,
7
+ 'data-types' => "#{list_subnet_types(f.object, accessible_subnets).to_json}" } %>
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
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.3.4
4
+ version: 0.3.5
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-09-10 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks
@@ -136,6 +136,7 @@ files:
136
136
  - app/models/staypuft/subnet_typing.rb
137
137
  - app/models/staypuft/deployment_role_hostgroup.rb
138
138
  - app/models/setting/staypuft_provisioning.rb
139
+ - app/overrides/nic_base_form.rb
139
140
  - app/overrides/customize_foreman_tasks_show_page.rb
140
141
  - app/overrides/foreman_hosts_edit.rb
141
142
  - app/overrides/hide_subscription_manager_passwords.rb
@@ -207,6 +208,8 @@ files:
207
208
  - app/views/staypuft/deployments/_import_form.html.erb
208
209
  - app/views/staypuft/deployments/_deployment_summary.html.erb
209
210
  - app/views/staypuft/deployments/_deployment_networking.html.erb
211
+ - app/views/nic/_subnet_id_field.html.erb
212
+ - app/helpers/staypuft/hosts_helper.rb
210
213
  - app/helpers/staypuft/deployments_helper.rb
211
214
  - app/helpers/staypuft/application_helper.rb
212
215
  - config/staypuft.local.rb