staypuft 0.1.7 → 0.1.9

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
- MWFkYzZlNjIwZjcxOWRjNTM0NmU4ZDVmYzFiNGZiZTY5OGRmN2ZlYQ==
4
+ NTQzMDU0YjdiZTZhMzFmNWMyZWQ1OWMyZjBlZjcyNDliYTRjZThmNg==
5
5
  data.tar.gz: !binary |-
6
- NjlkODZkMGY2OTNmZGJkMWQ3Y2E1MmIzODg2ZDc0ODczZTRiZGJkNA==
6
+ NTlhODNjYjdjYTY1ZDdhMDIyMGRlYWE3ZDc1NjQxMTY0YTJiZWNkMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDAyY2U4YjBlYTkyNDc3ZTNhN2JiNTk1ZGVmZDkxZmJlOTllODI2ODkxYzJk
10
- MWY0ZTMyZGY1NTBkOGUyYjczYmI5M2I2M2FkNDEzNmZiNDY3NzYxOGU4MmRk
11
- MGNiMTI5Y2U5MDM0MTliNTE3OTVmMzhkNDg5NWE0ZmE4ZWEwZjQ=
9
+ N2EzOWE0ZTE0MWI4MTk4MjI3MDM2NzA1MDlhZjdhMWVkNzZmMzQzZTQyNDA3
10
+ ZTMxODUzMGI4NGRlMmM3OTdjYTBiYTgxY2NhNTM1NWU4MzM5NTE2M2IyN2Uy
11
+ YmYwYTkxYWYzMTI3MDFlMzhjN2FiMDVlZDNmZjZiMTgxODM2MTQ=
12
12
  data.tar.gz: !binary |-
13
- MjQ2YzU1MmYzYmRhMGRjZDQxNWFlYTk5MWYzOTU2ODUzNTlhMGQ2YzllMWIy
14
- Y2JkYTc0ZGUzYjE3NzAzMGM2MjY1ODk3YzhhYTg5ZDY3ZWRjMGNmYmEzMjRj
15
- MGE1M2NkOWI5YWQ2MTg2NzA5YTMyZGIzNzU3YmVmYjkzNDUwNmE=
13
+ MmFmY2FmODIwM2VlYjgwYTQxZmVkNzk5NzNmYTJlZTU4OTFjM2EwMjgzYmNh
14
+ YWVmODRkNWVmZWJiNzI2ZjBiMzMwNmFkNTdkYmE0Yjg4YzI4OWE3ZDliOTk4
15
+ ZTdmMmNkN2RkYjBmZTQ1MDE3MjU4ODRhYjViODhhODM3NThiZDI=
@@ -40,7 +40,7 @@ $(function () {
40
40
  $('.tabbed_side_nav_table').on('click', 'button.close', function() {
41
41
  $(this).closest('.tab-pane.active').removeClass('active');
42
42
  $(this).closest('.tabbed_side_nav_table').find('.activated').removeClass('activated');
43
- })
43
+ });
44
44
 
45
45
  var duration = 150;
46
46
 
@@ -88,17 +88,6 @@ $(function () {
88
88
  }
89
89
  }
90
90
 
91
- showNeutronExternalVlan();
92
- $("input[name='staypuft_deployment[neutron][use_vlan_for_external_network]']").change(showNeutronExternalVlan);
93
- function showNeutronExternalVlan() {
94
- if ($('#staypuft_deployment_neutron_use_vlan_for_external_network').is(":checked")) {
95
- $('.neutron_external_vlan').fadeIn(duration);
96
- }
97
- else {
98
- $('.neutron_external_vlan').fadeOut(duration)
99
- }
100
- }
101
-
102
91
  showGlanceNfsNetworkPath();
103
92
  $("input[name='staypuft_deployment[glance][driver_backend]']").change(showGlanceNfsNetworkPath);
104
93
  function showGlanceNfsNetworkPath() {
@@ -87,8 +87,7 @@
87
87
 
88
88
  .tabbed_side_nav_table{
89
89
  .nav {
90
- padding-top: 5px;
91
- padding-right: 4px;
90
+ padding: 5px 4px 0px 15px;
92
91
  & > li.activated {
93
92
  z-index: 1;
94
93
  &:after, &:before {
@@ -9,10 +9,52 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
- *= require_tree .
13
12
  */
14
13
 
15
- //@import "bootstrap";
14
+ @import "bootstrap_and_overrides";
15
+ @import "bootstrap/buttons";
16
+ @import "bootstrap/forms";
17
+
18
+ .top_actions {
19
+ //same margin as h1 (title)
20
+ margin: 20px 0 10px;
21
+ }
22
+
23
+ .title h1 {
24
+ word-wrap: break-word;
25
+ }
26
+
27
+ span.editable, span.editable:hover {
28
+ background-color: transparent;
29
+ .spinner-placeholder{
30
+ margin:0;
31
+ background-repeat: no-repeat;
32
+ background-position: center center;
33
+ float: left;
34
+ padding: 0 150px;
35
+ }
36
+ form {
37
+ float: left;
38
+ @extend .form-inline;
39
+ }
40
+ input {
41
+ @extend .form-control;
42
+ width: auto !important;
43
+ margin-right: 10px;
44
+ }
45
+ button {
46
+ @extend .btn;
47
+ @extend .btn-default;
48
+ margin-right: 10px;
49
+ &:not(:last-child) {
50
+ @extend .btn-primary;
51
+ }
52
+ }
53
+ }
54
+
55
+ // span.edit_textfield button {
56
+ // margin-left: 5px;
57
+ // }
16
58
 
17
59
  .service-box {
18
60
  width: 200px;
@@ -25,20 +25,31 @@ module Staypuft
25
25
  end
26
26
 
27
27
  def update
28
- if params[:staypuft_deployment]
29
- param_data = params[:staypuft_deployment][:hostgroup_params]
30
- param_data.each do |hostgroup_id, hostgroup_params|
31
- hostgroup = Hostgroup.find(hostgroup_id)
32
- hostgroup_params[:puppetclass_params].each do |puppetclass_id, puppetclass_params|
33
- puppetclass = Puppetclass.find(puppetclass_id)
34
- puppetclass_params.each do |param_name, param_value|
35
- hostgroup.set_param_value_if_changed(puppetclass, param_name, param_value)
28
+ respond_to do | format |
29
+
30
+ format.html do
31
+ if params[:staypuft_deployment]
32
+ param_data = params[:staypuft_deployment][:hostgroup_params]
33
+ param_data.each do |hostgroup_id, hostgroup_params|
34
+ hostgroup = Hostgroup.find(hostgroup_id)
35
+ hostgroup_params[:puppetclass_params].each do |puppetclass_id, puppetclass_params|
36
+ puppetclass = Puppetclass.find(puppetclass_id)
37
+ puppetclass_params.each do |param_name, param_value|
38
+ hostgroup.set_param_value_if_changed(puppetclass, param_name, param_value)
39
+ end
40
+ end
36
41
  end
37
42
  end
43
+ redirect_to summary_deployment_path(params[:id])
44
+ end
45
+
46
+ format.json do
47
+ @deployment = Deployment.find(params[:id])
48
+ @deployment.update_attributes(params[:deployment])
49
+ render :status => 200, :json => @deployment.to_json
38
50
  end
39
- end
40
51
 
41
- redirect_to summary_deployment_path(params[:id])
52
+ end
42
53
  end
43
54
 
44
55
  def edit
@@ -1,5 +1,10 @@
1
1
  module Staypuft
2
2
  module ApplicationHelper
3
+
4
+ def subtitle(page_subtitle)
5
+ content_for(:subtitle, page_subtitle.to_s)
6
+ end
7
+
3
8
  def radio_button_f_non_inline(f, attr, options = {})
4
9
  text = options.delete(:text)
5
10
  value = options.delete(:value)
@@ -163,15 +163,16 @@ module Staypuft
163
163
 
164
164
  def functional_dependencies
165
165
  amqp_provider = '<%= @host.deployment.amqp_provider %>'
166
- neutron = '<%= @host.deployment.networking == Staypuft::Deployment::Networking::NEUTRON %>'
166
+ neutron = '<%= @host.deployment.neutron_networking? %>'
167
167
 
168
168
  # Nova
169
169
  network_manager = '<%= @host.deployment.nova.network_manager %>'
170
170
  # multi_host handled inline, since it's two separate static values 'true' and 'True'
171
- network_overrides = '<%= @host.deployment.nova.network_overrides.to_yaml %>'
172
- # TODO: determine whether num_networks and network_size are static or calculated
173
- network_num_networks = 1
174
- network_network_size = 255
171
+ network_overrides = '<%= @host.deployment.nova.network_overrides %>'
172
+ # TODO: num_networks should be calculated based on a specified VLAN range.
173
+ # Alternatively, it could be explicitly set by the user in combination
174
+ # with a starting VLAN ID.
175
+ network_num_networks = '<%= @host.deployment.nova.num_networks %>'
175
176
  network_fixed_range = '<%= @host.deployment.nova.private_fixed_range %>'
176
177
  network_floating_range = '<%= @host.deployment.nova.public_floating_range %>'
177
178
  network_private_iface = '<%= @host.deployment.nova.compute_tenant_interface %>'
@@ -201,15 +202,23 @@ module Staypuft
201
202
  pcmk_fs_dir = '<%= @host.deployment.glance.pcmk_fs_dir %>'
202
203
  pcmk_fs_manage = 'true'
203
204
  pcmk_fs_options = '<%= @host.deployment.glance.pcmk_fs_options %>'
205
+ glance_rbd_store_user = 'glance'
206
+ glance_rbd_store_pool = 'images'
204
207
 
205
208
  # Cinder
206
209
  volume = true
210
+ cinder_backend_gluster = false
211
+ cinder_backend_gluster_name = 'gluster_backend'
207
212
  cinder_backend_iscsi = '<%= @host.deployment.cinder.lvm_backend? %>'
213
+ cinder_backend_iscsi_name = 'iscsi_backend'
208
214
  cinder_backend_nfs = '<%= @host.deployment.cinder.nfs_backend? %>'
215
+ cinder_backend_nfs_name = 'nfs_backend'
216
+ cinder_multiple_backends = false
209
217
  cinder_nfs_shares = ['<%= @host.deployment.cinder.nfs_uri %>']
210
218
  cinder_nfs_mount_options = ''
211
219
 
212
220
  cinder_backend_rbd = '<%= @host.deployment.cinder.ceph_backend? %>'
221
+ cinder_backend_rbd_name = 'rbd_backend'
213
222
  # TODO: confirm these params and add them to model where user input is needed
214
223
  cinder_rbd_pool = 'volumes'
215
224
  cinder_rbd_ceph_conf = '/etc/ceph/ceph.conf/'
@@ -219,6 +228,7 @@ module Staypuft
219
228
  cinder_rbd_secret_uuid = ''
220
229
 
221
230
  cinder_backend_eqlx = '<%= @host.deployment.cinder.equallogic_backend? %>'
231
+ cinder_backend_eqlx_name = ['eqlx_backend']
222
232
  # TODO: confirm these params and add them to model where user input is needed
223
233
  # below dynamic calls are commented out since the model does not yet have san/chap entries
224
234
  cinder_san_ip = [''] # ['<%= #@host.deployment.cinder.san_ip %>']
@@ -279,18 +289,25 @@ module Staypuft
279
289
  {
280
290
  'quickstack::nova_network::controller' => {
281
291
  'amqp_provider' => amqp_provider,
292
+ 'cinder_backend_gluster' => cinder_backend_gluster,
293
+ 'cinder_backend_gluster_name' => cinder_backend_gluster_name,
282
294
  'cinder_backend_iscsi' => cinder_backend_iscsi,
295
+ 'cinder_backend_iscsi_name' => cinder_backend_iscsi_name,
283
296
  'cinder_backend_nfs' => cinder_backend_nfs,
297
+ 'cinder_backend_nfs_name' => cinder_backend_nfs_name,
298
+ 'cinder_backend_rbd' => cinder_backend_rbd,
299
+ 'cinder_backend_rbd_name' => cinder_backend_rbd_name,
300
+ 'cinder_backend_eqlx' => cinder_backend_eqlx,
301
+ 'cinder_backend_eqlx_name' => cinder_backend_eqlx_name,
302
+ 'cinder_multiple_backends' => cinder_multiple_backends,
284
303
  'cinder_nfs_shares' => cinder_nfs_shares,
285
304
  'cinder_nfs_mount_options' => cinder_nfs_mount_options,
286
- 'cinder_backend_rbd' => cinder_backend_rbd,
287
305
  'cinder_rbd_pool' => cinder_rbd_pool,
288
306
  'cinder_rbd_ceph_conf' => cinder_rbd_ceph_conf,
289
307
  'cinder_rbd_flatten_volume_from_snapshot' => cinder_rbd_flatten_volume_from_snapshot,
290
308
  'cinder_rbd_max_clone_depth' => cinder_rbd_max_clone_depth,
291
309
  'cinder_rbd_user' => cinder_rbd_user,
292
310
  'cinder_rbd_secret_uuid' => cinder_rbd_secret_uuid,
293
- 'cinder_backend_eqlx' => cinder_backend_eqlx,
294
311
  'cinder_san_ip' => cinder_san_ip,
295
312
  'cinder_san_login' => cinder_san_login,
296
313
  'cinder_san_password' => cinder_san_password,
@@ -301,6 +318,8 @@ module Staypuft
301
318
  'cinder_eqlx_chap_login' => cinder_eqlx_chap_login,
302
319
  'cinder_eqlx_chap_password' => cinder_eqlx_chap_password,
303
320
  'glance_backend' => backend,
321
+ 'glance_rbd_store_user' => glance_rbd_store_user,
322
+ 'glance_rbd_store_pool' => glance_rbd_store_pool,
304
323
  'admin_password' => admin_pw,
305
324
  'ceilometer_user_password' => ceilometer_user_pw,
306
325
  'cinder_db_password' => cinder_db_pw,
@@ -338,18 +357,25 @@ module Staypuft
338
357
  'ml2_vni_ranges' => ml2_vni_ranges,
339
358
  'ovs_vlan_ranges' => ovs_vlan_ranges,
340
359
  'enable_tunneling' => enable_tunneling,
360
+ 'cinder_backend_gluster' => cinder_backend_gluster,
361
+ 'cinder_backend_gluster_name' => cinder_backend_gluster_name,
341
362
  'cinder_backend_iscsi' => cinder_backend_iscsi,
363
+ 'cinder_backend_iscsi_name' => cinder_backend_iscsi_name,
342
364
  'cinder_backend_nfs' => cinder_backend_nfs,
365
+ 'cinder_backend_nfs_name' => cinder_backend_nfs_name,
366
+ 'cinder_backend_rbd' => cinder_backend_rbd,
367
+ 'cinder_backend_rbd_name' => cinder_backend_rbd_name,
368
+ 'cinder_backend_eqlx' => cinder_backend_eqlx,
369
+ 'cinder_backend_eqlx_name' => cinder_backend_eqlx_name,
370
+ 'cinder_multiple_backends' => cinder_multiple_backends,
343
371
  'cinder_nfs_shares' => cinder_nfs_shares,
344
372
  'cinder_nfs_mount_options' => cinder_nfs_mount_options,
345
- 'cinder_backend_rbd' => cinder_backend_rbd,
346
373
  'cinder_rbd_pool' => cinder_rbd_pool,
347
374
  'cinder_rbd_ceph_conf' => cinder_rbd_ceph_conf,
348
375
  'cinder_rbd_flatten_volume_from_snapshot' => cinder_rbd_flatten_volume_from_snapshot,
349
376
  'cinder_rbd_max_clone_depth' => cinder_rbd_max_clone_depth,
350
377
  'cinder_rbd_user' => cinder_rbd_user,
351
378
  'cinder_rbd_secret_uuid' => cinder_rbd_secret_uuid,
352
- 'cinder_backend_eqlx' => cinder_backend_eqlx,
353
379
  'cinder_san_ip' => cinder_san_ip,
354
380
  'cinder_san_login' => cinder_san_login,
355
381
  'cinder_san_password' => cinder_san_password,
@@ -360,6 +386,8 @@ module Staypuft
360
386
  'cinder_eqlx_chap_login' => cinder_eqlx_chap_login,
361
387
  'cinder_eqlx_chap_password' => cinder_eqlx_chap_password,
362
388
  'glance_backend' => backend,
389
+ 'glance_rbd_store_user' => glance_rbd_store_user,
390
+ 'glance_rbd_store_pool' => glance_rbd_store_pool,
363
391
  'admin_password' => admin_pw,
364
392
  'ceilometer_user_password' => ceilometer_user_pw,
365
393
  'cinder_db_password' => cinder_db_pw,
@@ -444,6 +472,7 @@ module Staypuft
444
472
  'nova_public_vip' => vip_format % :nova,
445
473
  'amqp_vip' => vip_format % :amqp,
446
474
  'swift_public_vip' => vip_format % :swift,
475
+ 'cluster_control_ip' => '<%= @host.deployment.ips.controller_ips.first %>',
447
476
  'lb_backend_server_addrs' => '<%= @host.deployment.ips.controller_ips %>',
448
477
  'lb_backend_server_names' => '<%= @host.deployment.ips.controller_fqdns %>' },
449
478
  'quickstack::pacemaker::common' => {
@@ -469,6 +498,7 @@ module Staypuft
469
498
  'volume' => volume,
470
499
  'backend_iscsi' => cinder_backend_iscsi,
471
500
  'backend_nfs' => cinder_backend_nfs,
501
+ 'backend_gluster' => cinder_backend_gluster,
472
502
  'nfs_shares' => cinder_nfs_shares,
473
503
  'nfs_mount_options' => cinder_nfs_mount_options,
474
504
  'backend_rbd' => cinder_backend_rbd,
@@ -527,10 +557,11 @@ module Staypuft
527
557
  'amqp_password' => amqp_pw },
528
558
  'quickstack::nova_network::compute' => {
529
559
  'amqp_provider' => amqp_provider,
560
+ 'cinder_backend_gluster' => cinder_backend_gluster,
561
+ 'cinder_backend_nfs' => cinder_backend_nfs,
530
562
  'network_manager' => network_manager,
531
563
  'network_overrides' => network_overrides,
532
564
  'network_num_networks' => network_num_networks,
533
- 'network_network_size' => network_network_size,
534
565
  'network_fixed_range' => network_fixed_range,
535
566
  'network_floating_range' => network_floating_range,
536
567
  'network_private_iface' => network_private_iface,
@@ -550,6 +581,8 @@ module Staypuft
550
581
  'nova_host' => nova_host },
551
582
  'quickstack::neutron::compute' => {
552
583
  'amqp_provider' => amqp_provider,
584
+ 'cinder_backend_gluster' => cinder_backend_gluster,
585
+ 'cinder_backend_nfs' => cinder_backend_nfs,
553
586
  'enable_tunneling' => enable_tunneling,
554
587
  'ovs_bridge_mappings' => compute_ovs_bridge_mappings,
555
588
  'ovs_bridge_uplinks' => compute_ovs_bridge_uplinks,
@@ -652,7 +685,10 @@ module Staypuft
652
685
  param = puppetclass.class_params.find_by_key(param_key)
653
686
  unless param
654
687
  Rails.logger.error "missing param #{param_key} in #{puppetclass_name} trying to set default_value: #{default_value.inspect} found in puppetclasses: " +
655
- LookupKey.search_for(param_key).map { |lk| (c = (lk.param_class || lk.puppetclass)).nil? ? "class not found" : c.name }.inspect
688
+ LookupKey.
689
+ smart_class_parameters.
690
+ search_for("key = #{param_key}").
691
+ map { |lk| lk.param_class.name }.inspect
656
692
  next
657
693
  end
658
694
  unless param.update_attributes default_value: default_value
@@ -43,3 +43,7 @@ module Staypuft
43
43
  end
44
44
  end
45
45
  end
46
+
47
+ class ::Host::Managed::Jail < Safemode::Jail
48
+ allow :deployment
49
+ end
@@ -30,13 +30,26 @@ module Staypuft::Concerns::LookupKeyExtensions
30
30
  self.send(method, value) rescue raise TypeError
31
31
  end
32
32
 
33
- def has_erb? value
33
+ def self.has_erb?(value)
34
34
  value =~ /<%.*%>/
35
35
  end
36
36
 
37
+ def has_erb?(value)
38
+ Staypuft::Concerns::LookupKeyExtensions.has_erb? value
39
+ end
40
+
41
+ def self.evaluate_value(hostgroup, value)
42
+ host = Host::Managed.new(hostgroup: hostgroup, name: 'renderer')
43
+ SafeRender.new(:variables => { :host => host }).parse(value)
44
+ rescue => e
45
+ "ERROR: #{e.message} (#{e.class})"
46
+ end
47
+
37
48
  def value_before_type_cast_with_limpet(value)
38
- value_before_type_cast_without_limpet(value).tap do |v|
39
- v.gsub!(LIMPET_FORMAT_REGEXP, '<%=') if has_erb? v
49
+ if has_erb? value
50
+ value.gsub(LIMPET_FORMAT_REGEXP, '<%=')
51
+ else
52
+ value_before_type_cast_without_limpet(value)
40
53
  end
41
54
  end
42
55
 
@@ -64,6 +77,10 @@ module Staypuft::Concerns::LookupKeyExtensions
64
77
  else
65
78
  value
66
79
  end
80
+ rescue => exc
81
+ # TODO fix in foreman
82
+ Rails.logger.error "There was error rendering string: #{string.inspect}\n#{exc} (#{exc.class})\n#{exc.backtrace.join("\n")}"
83
+ raise exc
67
84
  end
68
85
  end
69
86
  end
@@ -18,11 +18,11 @@ module Staypuft
18
18
  TYPES = LABELS.keys
19
19
  HUMAN = N_('Choose Driver Backend')
20
20
  end
21
- validates :driver_backend, presence: true, inclusion: { in: lambda {|c| c.backend_types_for_layout } }
21
+ validates :driver_backend, presence: true, inclusion: { in: lambda { |c| c.backend_types_for_layout } }
22
22
 
23
23
  module NfsUri
24
- HUMAN = N_('NFS URI:')
25
- HUMAN_AFTER = N_('("example.com/path/to/mount")')
24
+ HUMAN = N_('NFS URI:')
25
+ HUMAN_AFTER = Deployment::GlanceService::NFS_HELP
26
26
  end
27
27
  validates :nfs_uri,
28
28
  :presence => true,
@@ -34,6 +34,10 @@ module Staypuft
34
34
  # TODO: add EqualLogic UI parameters
35
35
 
36
36
 
37
+ class Jail < Safemode::Jail
38
+ allow :lvm_backend?, :nfs_backend?, :nfs_uri, :ceph_backend?, :equallogic_backend?
39
+ end
40
+
37
41
  def set_defaults
38
42
  self.driver_backend = DriverBackend::LVM
39
43
  end
@@ -4,6 +4,8 @@ module Staypuft
4
4
  'glance'
5
5
  end
6
6
 
7
+ NFS_HELP = N_('(<server>:<local path>)')
8
+
7
9
  param_attr :driver_backend, :nfs_network_path, :gluster_network_path,
8
10
  :gluster_backup_volfile_servers
9
11
 
@@ -20,7 +22,7 @@ module Staypuft
20
22
 
21
23
  module NfsNetworkPath
22
24
  HUMAN = N_('network path')
23
- HUMAN_AFTER = '(server:localpath)'
25
+ HUMAN_AFTER = NFS_HELP
24
26
  end
25
27
 
26
28
  validates :nfs_network_path,
@@ -28,6 +30,10 @@ module Staypuft
28
30
  :if => :nfs_backend?
29
31
  # TODO: network_path validation
30
32
 
33
+ class Jail < Safemode::Jail
34
+ allow :driver_backend, :pcmk_fs_device, :pcmk_fs_dir, :pcmk_fs_options
35
+ end
36
+
31
37
  def set_defaults
32
38
  self.driver_backend = DriverBackend::LOCAL
33
39
  end
@@ -1,6 +1,10 @@
1
1
  module Staypuft
2
2
  class Deployment::IPS < Deployment::AbstractParamScope
3
3
 
4
+ class Jail < Safemode::Jail
5
+ allow :controller_ip, :controller_ips, :controller_fqdns
6
+ end
7
+
4
8
  def controllers
5
9
  @controllers ||= Hostgroup.
6
10
  includes(:deployment_role_hostgroup).
@@ -10,8 +10,7 @@ module Staypuft
10
10
 
11
11
 
12
12
  param_attr :network_segmentation, :tenant_vlan_ranges, :networker_tenant_interface,
13
- :use_external_interface, :external_interface_name, :compute_tenant_interface,
14
- :use_vlan_for_external_network, :vlan_ranges_for_external_network
13
+ :use_external_interface, :external_interface_name, :compute_tenant_interface
15
14
 
16
15
  module NetworkSegmentation
17
16
  VXLAN = 'vxlan'
@@ -63,22 +62,6 @@ module Staypuft
63
62
  :if => :use_external_interface?
64
63
  # TODO: interface name format validation
65
64
 
66
- module UseVlanForExternalNetwork
67
- HUMAN = N_('Configure VLAN for external network')
68
- end
69
-
70
- validates :use_vlan_for_external_network, inclusion: { in: [true, false, 'true', 'false'] }
71
-
72
- module VlanRangesForExternalNetwork
73
- HUMAN = N_('VLAN Range for external network')
74
- HUMAN_AFTER = N_('i.e. 1000:2999')
75
- end
76
-
77
- validates :vlan_ranges_for_external_network,
78
- :presence => true,
79
- :if => :external_network_vlan?
80
- # TODO: vlan rangesformat validation
81
-
82
65
  module ComputeTenantInterface
83
66
  HUMAN = N_('Which interface to use for tenant networks:')
84
67
  HUMAN_AFTER = INTERFACE_HELP
@@ -88,6 +71,12 @@ module Staypuft
88
71
  :presence => true
89
72
  # TODO: interface name format validation
90
73
 
74
+ class Jail < Safemode::Jail
75
+ allow :networker_vlan_ranges, :compute_vlan_ranges, :network_segmentation, :enable_tunneling?,
76
+ :networker_tenant_interface, :networker_ovs_bridge_mappings, :networker_ovs_bridge_uplinks,
77
+ :compute_tenant_interface, :compute_ovs_bridge_mappings, :compute_ovs_bridge_uplinks
78
+ end
79
+
91
80
  def set_defaults
92
81
  self.network_segmentation = NetworkSegmentation::VXLAN
93
82
  self.use_external_interface = 'false'
@@ -102,11 +91,6 @@ module Staypuft
102
91
  (self.use_external_interface == true) || (self.use_external_interface == 'true')
103
92
  end
104
93
 
105
- # TODO: make this less clumsy w/ consistent handling of true/false values
106
- def use_vlan_for_external_network?
107
- (self.use_vlan_for_external_network == true) || (self.use_vlan_for_external_network == 'true')
108
- end
109
-
110
94
  # return list of supported segmentation options with selected option at the
111
95
  # beginning of the list
112
96
  def network_segmentation_list
@@ -150,17 +134,13 @@ module Staypuft
150
134
 
151
135
  def networker_vlan_ranges
152
136
  [("physnet-tenants:#{self.tenant_vlan_ranges}" if self.vlan_segmentation?),
153
- ("physnet-external:#{self.vlan_ranges_for_external_network}" if self.external_network_vlan?)].compact
137
+ "physnet-external"].compact
154
138
  end
155
139
 
156
140
  def vlan_segmentation?
157
141
  self.network_segmentation == NetworkSegmentation::VLAN
158
142
  end
159
143
 
160
- def external_network_vlan?
161
- self.use_external_interface? && self.use_vlan_for_external_network?
162
- end
163
-
164
144
  def enable_tunneling?
165
145
  [NetworkSegmentation::VXLAN, NetworkSegmentation::GRE].include?(network_segmentation)
166
146
  end
@@ -80,7 +80,17 @@ module Staypuft
80
80
  def network_overrides
81
81
  { 'force_dhcp_release' => false }.tap do |h|
82
82
  h.update 'vlan_start' => self.vlan_range.split(':')[0] if self.vlan_manager?
83
- end
83
+ end.to_yaml
84
+ end
85
+
86
+ # TODO: make this dynamic
87
+ def num_networks
88
+ 1
89
+ end
90
+
91
+ class Jail < Safemode::Jail
92
+ allow :network_manager, :network_overrides, :private_fixed_range, :public_floating_range,
93
+ :compute_tenant_interface, :external_interface_name, :num_networks
84
94
  end
85
95
 
86
96
  end
@@ -40,6 +40,11 @@ module Staypuft
40
40
  :if => :single_mode?,
41
41
  :length => { minimum: 6 }
42
42
 
43
+ class Jail < Safemode::Jail
44
+ allow :effective_value, :ceilometer_metering_secret, :heat_auth_encrypt_key,
45
+ :horizon_secret_key, :swift_shared_secret, :neutron_metadata_proxy_secret
46
+ end
47
+
43
48
  def set_defaults
44
49
  self.mode = Mode::RANDOM
45
50
  PASSWORD_LIST.each do |password_field|
@@ -13,6 +13,10 @@ module Staypuft
13
13
 
14
14
  HUMAN = N_('Virtual IP addresses range')
15
15
 
16
+ class Jail < Safemode::Jail
17
+ allow :get
18
+ end
19
+
16
20
  def range
17
21
  (user_range || default_range)
18
22
  # TODO reserve the IP addresses
@@ -71,7 +71,7 @@ module Staypuft
71
71
  def initialize(attributes = {}, options = {})
72
72
  super({ amqp_provider: AmqpProvider::RABBITMQ,
73
73
  layout_name: LayoutName::NON_HA,
74
- networking: Networking::NOVA,
74
+ networking: Networking::NEUTRON,
75
75
  platform: Platform::RHEL7 }.merge(attributes),
76
76
  options)
77
77
 
@@ -119,7 +119,7 @@ module Staypuft
119
119
  module Networking
120
120
  NOVA = 'nova'
121
121
  NEUTRON = 'neutron'
122
- LABELS = { NOVA => N_('Nova Network'), NEUTRON => N_('Neutron Networking') }
122
+ LABELS = { NEUTRON => N_('Neutron Networking'), NOVA => N_('Nova Network') }
123
123
  TYPES = LABELS.keys
124
124
  HUMAN = N_('Networking')
125
125
  end
@@ -148,6 +148,11 @@ module Staypuft
148
148
  validates :layout_name, presence: true, inclusion: { in: LayoutName::TYPES }
149
149
  validates :platform, presence: true, inclusion: { in: Platform::TYPES }
150
150
 
151
+ class Jail < Safemode::Jail
152
+ allow :amqp_provider, :networking, :layout_name, :platform, :nova_networking?, :neutron_networking?,
153
+ :nova, :neutron, :glance, :cinder, :passwords, :vips, :ips, :ha?
154
+ end
155
+
151
156
  # TODO(mtaylor)
152
157
  # Use conditional validations to validate the deployment multi-step form.
153
158
  # deployment.form_step should be used to check the form step the user is
@@ -189,6 +194,14 @@ module Staypuft
189
194
  self.layout_name == LayoutName::HA
190
195
  end
191
196
 
197
+ def nova_networking?
198
+ networking == Networking::NOVA
199
+ end
200
+
201
+ def neutron_networking?
202
+ networking == Networking::NEUTRON
203
+ end
204
+
192
205
  private
193
206
 
194
207
  def update_layout
@@ -1,6 +1,6 @@
1
1
  <% title _("Edit - %s Configuration Parameters") % @deployment.name %>
2
- <% content_for(:title_actions) do %>
3
- <%= link_to _("Back to Deployment"), deployment_path(@deployment.id) %>
2
+ <% content_for(:top_actions) do %>
3
+ <%= link_to _("Back to Deployment"), deployment_path(@deployment.id), :class => "btn btn-link" %>
4
4
  <%= link_to _("Apply"), '',
5
5
  class: "btn btn-primary",
6
6
  id: 'edit_staypuft_deployment_submit' %>
@@ -1,25 +1,19 @@
1
- <% title @deployment.name %>
1
+ <% title(@deployment.name, edit_textfield(@deployment, :name, options={:update_url => deployment_path(@deployment)})) %>
2
+ <% subtitle edit_textfield(@deployment, :description, options={:update_url => deployment_path(@deployment)}) %>
2
3
 
3
- <% content_for(:title_actions) do %>
4
- <%= link_to(_("Advanced Configuration"), summary_deployment_path(@deployment.id), :class => '') %>
4
+ <% content_for(:top_actions) do %>
5
+ <%= link_to(_("Advanced Configuration"), summary_deployment_path(@deployment.id), :class => 'btn btn-link') %>
5
6
  <%= link_to(_("Revisit Setup Wizard"), if @deployment.deployed?
6
7
  deployment_step_path(deployment_id: @deployment, id: 'services_configuration')
7
8
  else
8
9
  deployment_steps_path(deployment_id: @deployment)
9
- end) %>
10
+ end, :class => "btn btn-default") %>
10
11
 
11
- <% if @deployment.in_progress? %>
12
- <%= display_link_if_authorized(
13
- _('Deploy in progress'),
14
- hash_for_foreman_tasks_task_path(id: ForemanTasks::Lock.colliding_locks(@deployment, nil).first.task.id),
15
- :class => 'btn-info') %>
16
- <% else %>
17
- <%= link_to(_("Deploy"),
18
- "",
19
- :class => %w(btn btn-primary),
20
- :'data-toggle' => "modal",
21
- :'data-target' => "#deploy_modal") %>
22
- <% end %>
12
+ <%= link_to(_("Deploy"),
13
+ "",
14
+ :class => @deployment.in_progress? ? %w(btn btn-primary disabled) : %w(btn btn-primary),
15
+ :'data-toggle' => "modal",
16
+ :'data-target' => "#deploy_modal") %>
23
17
 
24
18
  <% if Rails.env.development? %>
25
19
  <div class="btn-group">
@@ -1,16 +1,17 @@
1
1
  <% title _("%s Configuration Parameters") % @deployment.name %>
2
- <% content_for(:title_actions) do %>
3
- <%= link_to _("Back to Deployment"), deployment_path(@deployment.id) %>
2
+ <% content_for(:top_actions) do %>
3
+ <%= link_to _("Back to Deployment"), deployment_path(@deployment.id), :class => "btn btn-link" %>
4
4
  <%= link_to(icon_text("cloud-upload", _("Import")),
5
5
  {},
6
- { :remote => true,
6
+ { :class => "btn btn-default",
7
+ :remote => true,
7
8
  :rel => 'popover',
8
9
  :data => { 'content' => "#{render partial: 'import_form'}",
9
10
  'original-title' => _('Import Config'),
10
11
  'placement' => 'left' } }) %>
11
12
  <%= link_to(icon_text("cloud-download", _("Export")),
12
- export_config_deployment_path(@deployment.id)) %>
13
- <%= link_to _("Edit"), edit_deployment_path(@deployment.id) %>
13
+ export_config_deployment_path(@deployment.id), :class => "btn btn-default") %>
14
+ <%= link_to _("Edit"), edit_deployment_path(@deployment.id), :class => "btn btn-default" %>
14
15
  <% end %>
15
16
 
16
17
  <div class="col-md-12">
@@ -41,10 +42,16 @@
41
42
  param_hash[:hostgroup].id,
42
43
  param_hash[:puppetclass].id,
43
44
  param_hash[:param_key].key),
44
- param_hash[:hostgroup].current_param_value_str(param_hash[:param_key]),
45
+ value = param_hash[:hostgroup].current_param_value_str(param_hash[:param_key]),
45
46
  :class => "form-control",
46
47
  :size => "45",
47
48
  disabled: true %>
49
+ <% if Staypuft::Concerns::LookupKeyExtensions.has_erb? value %>
50
+ <span class="help-block">
51
+ <%= _('evaluates to: ') %>
52
+ <%= Staypuft::Concerns::LookupKeyExtensions.evaluate_value param_hash[:hostgroup], value %>
53
+ </span>
54
+ <% end %>
48
55
  </div>
49
56
  </div>
50
57
  <br/>
@@ -52,7 +59,7 @@
52
59
  <% else %>
53
60
  <p><%= _("No configuration needed for this service.") %></p>
54
61
  <% end %>
55
- <% # render "puppetclasses/classes_parameters", { :obj => service.hostgroups.first } %>
62
+ <% # render "puppetclasses/classes_parameters", { :obj => service.hostgroups.first } %>
56
63
  </div>
57
64
  <% end %>
58
65
  </div>
@@ -0,0 +1,44 @@
1
+ <%= content_for(:content) do %>
2
+ <div id="main">
3
+ <%= content_tag('div', flash[:error], :class => 'flash hide error') if flash[:error] %>
4
+ <%= content_tag('div', flash[:warning], :class => 'flash hide warning') if flash[:warning] %>
5
+ <%= content_tag('div', flash[:notice], :class => 'flash hide notice') if flash[:notice] %>
6
+ <%= render 'common/notice' unless @notices.empty? %>
7
+ <div id="content" class="container">
8
+ <div class="title row form-group">
9
+ <div class="col-sm-12">
10
+ <div class="pull-left">
11
+ <h1 class=""><%=h @page_header if @page_header.present? %></h1>
12
+ <% if content_for? :subtitle %>
13
+ <div class="subtitle">
14
+ <%= yield(:subtitle) %>
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ <% if content_for? :top_actions %>
19
+ <div class="top_actions pull-right">
20
+ <div class="btn-toolbar pull-right">
21
+ <%= yield(:top_actions) %>
22
+ </div>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ </div>
27
+ <% if content_for?(:search_bar) || content_for?(:title_actions) %>
28
+ <div class="row">
29
+ <div class="title_filter <%= searchable? ? "col-md-6" : "col-md-4" %>">
30
+ <%= render "common/searchbar" if searchable? %>
31
+ <%= yield(:search_bar) %>&nbsp;
32
+ </div>
33
+ <div id="title_action" class="<%= searchable? ? "col-md-6" : "col-md-8" %>">
34
+ <div class="btn-toolbar pull-right"><%=h yield(:title_actions) %></div>
35
+ </div>
36
+ </div>
37
+ <% end %>
38
+
39
+ <%= yield %>
40
+ </div>
41
+ </div>
42
+ <% end %>
43
+
44
+ <%= render :template => 'layouts/base' %>
@@ -7,4 +7,4 @@
7
7
  <% end %>
8
8
 
9
9
 
10
- <%= render :template => 'layouts/application' %>
10
+ <%= render :template => 'staypuft/layouts/application' %>
@@ -31,18 +31,6 @@
31
31
  label: _(Staypuft::Deployment::NeutronService::ExternalInterfaceName::HUMAN),
32
32
  help_inline: _(Staypuft::Deployment::NeutronService::ExternalInterfaceName::HUMAN_AFTER)) %>
33
33
 
34
- <%= check_box_f_non_inline(p, :use_vlan_for_external_network,
35
- :checked_value => 'true',
36
- :unchecked_value => 'false',
37
- :text => Staypuft::Deployment::NeutronService::UseVlanForExternalNetwork::HUMAN)
38
- %>
39
-
40
- <div class="neutron_external_vlan col-md-offset-0 hide">
41
- <%= change_label_width 4, text_f(p, :vlan_ranges_for_external_network,
42
- label: _(Staypuft::Deployment::NeutronService::VlanRangesForExternalNetwork::HUMAN),
43
- help_inline: _(Staypuft::Deployment::NeutronService::VlanRangesForExternalNetwork::HUMAN_AFTER)) %>
44
- </div>
45
-
46
34
  </div>
47
35
 
48
36
 
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.9'
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.1.7
4
+ version: 0.1.9
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-07-03 00:00:00.000000000 Z
11
+ date: 2014-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks
@@ -134,6 +134,7 @@ files:
134
134
  - app/views/staypuft/deployments/index.html.erb
135
135
  - app/views/staypuft/deployments/show.html.erb
136
136
  - app/views/staypuft/deployments/summary.html.erb
137
+ - app/views/staypuft/layouts/application.html.erb
137
138
  - app/views/staypuft/layouts/staypuft.html.erb
138
139
  - app/views/staypuft/steps/_cinder.html.erb
139
140
  - app/views/staypuft/steps/_glance.html.erb