staypuft 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96268aa2d192eb421898423d6559a5d3344855a8
4
- data.tar.gz: 045c68a430a1375198f3ea52a95c6dbd41ab90a0
3
+ metadata.gz: f616a792efe16f83b8c83d62da0008a7fbe6afed
4
+ data.tar.gz: 186093722a498f08ea2143d61c6a0aa048268d04
5
5
  SHA512:
6
- metadata.gz: cbb30bec65a2635dc2f347af6cb183331b540976ff79a0b79d8a742f82fd1a284d023a9a6ee643639245ce93ca8ffbe97aac1eeed0e75ff1acbfb6c18a9cd61c
7
- data.tar.gz: 3d84e07780685aa36f75d48c5ed9e1f81d4b8465e057ea2678496c98c884add023d62c04bd2fb078f1c807bf94ce1b8c08a265845b060da6b378a42c332793c4
6
+ metadata.gz: 8555b75382a71b0f8aa772f8cb40b7c6541c9e57af20774866456e07f960b45d886532895f727cf737480d1209082d2cc3faea0e7a62533206b8b27eebeffb6b
7
+ data.tar.gz: 77fdbd263442637f2902a7f7d34f998b8b3bb32db6c07234c1f4349a29804a8ac2d5e7f95a91ce50aa32e8c07deca192800576781c0d3f629f27b3e794ca8f91
@@ -201,5 +201,14 @@ $(function () {
201
201
  $("#undeploy_hosts_modal").attr("disabled", !deployed_host_checkboxes.is(":checked"));
202
202
  });
203
203
 
204
+ var hosts_filter = $('.hosts_filter');
205
+ hosts_filter.keyup(function () {
206
+ var rex = new RegExp($(this).val(), 'i');
207
+ $('.searchable tr').hide();
208
+ $('.searchable tr').filter(function () {
209
+ return rex.test($(this).text());
210
+ }).show();
211
+ });
204
212
 
213
+ $('.inner-nav').click(function(){ hosts_filter.val("").keyup(); });
205
214
  });
@@ -26,12 +26,49 @@ module Actions
26
26
  # hostgroup.hosts returns already converted hosts from Host::Discovered with build flag
27
27
  # set to false so they are not built when assigned to the hostgroup in wizard
28
28
  # run Hostgroup's Hosts filtered by hosts
29
- (hostgroup.hosts & hosts).each do |host|
29
+ host_list = hostgroup.hosts & hosts
30
+ orchestration_mode = hostgroup.role.orchestration unless hostgroup.role.nil?
31
+
32
+ case orchestration_mode
33
+ when ::Staypuft::Role::ORCHESTRATION_CONCURRENT
34
+ deploy_concurrently(host_list)
35
+ when ::Staypuft::Role::ORCHESTRATION_SERIAL
36
+ deploy_serially(host_list)
37
+ when ::Staypuft::Role::ORCHESTRATION_LEADER
38
+ deploy_leader_first(host_list)
39
+ else
40
+ deploy_concurrently(host_list)
41
+ end
42
+ end
43
+
44
+ def deploy_concurrently(hosts)
45
+ hosts.each do |host|
30
46
  # planned in concurrence
31
47
  plan_action Host::Deploy, host
32
48
  end
33
49
  end
34
50
 
51
+ def deploy_serially(hosts)
52
+ sequence do
53
+ hosts.each do |host|
54
+ plan_action Host::Deploy, host
55
+ end
56
+ end
57
+ end
58
+
59
+ def deploy_leader_first(hosts)
60
+ first_host = hosts.shift
61
+ sequence do
62
+ #deploy first host, then deploy remainder in parallel
63
+ plan_action Host::Deploy, first_host unless first_host.nil?
64
+ concurrence do
65
+ hosts.each do |host|
66
+ plan_action Host::Deploy, host
67
+ end
68
+ end
69
+ end
70
+ end
71
+
35
72
  def humanized_input
36
73
  input[:name]
37
74
  end
@@ -112,42 +112,50 @@ module Staypuft
112
112
  # until we get the real list of roles per layout
113
113
  # layout refs below specify layout keys from layouts hash
114
114
  ROLES = [
115
- { :name => 'Controller (Nova)',
116
- :class => 'quickstack::nova_network::controller',
117
- :layouts => [[:non_ha_nova, 1]],
118
- :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance,
119
- :cinder_controller, :heat, :ceilometer] },
120
- { :name => 'Compute (Nova)',
121
- :class => [],
122
- :layouts => [[:ha_nova, 10], [:non_ha_nova, 10]],
123
- :services => [:nova_compute] },
124
- { :name => 'Controller (Neutron)',
125
- :class => 'quickstack::neutron::controller',
126
- :layouts => [[:non_ha_neutron, 1]],
127
- :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance,
128
- :cinder_controller, :heat, :ceilometer] },
129
- { :name => 'Compute (Neutron)',
130
- :class => [],
131
- :layouts => [[:ha_neutron, 10], [:non_ha_neutron, 10]],
132
- :services => [:neutron_compute] },
133
- { :name => 'Neutron Networker',
134
- :class => [],
135
- :layouts => [[:non_ha_neutron, 3]],
136
- :services => [:neutron_networker] },
137
- { :name => 'Cinder Block Storage',
138
- :class => [],
139
- :layouts => [],
140
- :services => [:cinder_node] },
141
- { :name => 'Swift Storage Node',
142
- :class => [],
143
- :layouts => [],
144
- :services => [:swift] },
145
- { :name => 'HA Controller',
146
- :class => [],
147
- :layouts => [[:ha_nova, 1], [:ha_neutron, 1]],
148
- :services => [:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha,
149
- :glance_ha, :nova_ha, :heat_ha, :cinder_ha, :swift_ha, :horizon_ha, :mysql_ha,
150
- :neutron_ha, :galera_ha] }]
115
+ { :name => 'Controller (Nova)',
116
+ :class => 'quickstack::nova_network::controller',
117
+ :layouts => [[:non_ha_nova, 1]],
118
+ :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :nova_controller, :non_ha_glance,
119
+ :cinder_controller, :heat, :ceilometer],
120
+ :orchestration => 'concurrent' },
121
+ { :name => 'Compute (Nova)',
122
+ :class => [],
123
+ :layouts => [[:ha_nova, 10], [:non_ha_nova, 10]],
124
+ :services => [:nova_compute],
125
+ :orchestration => 'leader' },
126
+ { :name => 'Controller (Neutron)',
127
+ :class => 'quickstack::neutron::controller',
128
+ :layouts => [[:non_ha_neutron, 1]],
129
+ :services => [:non_ha_amqp, :mysql, :non_ha_keystone, :neutron_controller, :non_ha_glance,
130
+ :cinder_controller, :heat, :ceilometer],
131
+ :orchestration => 'concurrent' },
132
+ { :name => 'Compute (Neutron)',
133
+ :class => [],
134
+ :layouts => [[:ha_neutron, 10], [:non_ha_neutron, 10]],
135
+ :services => [:neutron_compute],
136
+ :orchestration => 'concurrent' },
137
+ { :name => 'Neutron Networker',
138
+ :class => [],
139
+ :layouts => [[:non_ha_neutron, 3]],
140
+ :services => [:neutron_networker],
141
+ :orchestration => 'concurrent' },
142
+ { :name => 'Cinder Block Storage',
143
+ :class => [],
144
+ :layouts => [],
145
+ :services => [:cinder_node],
146
+ :orchestration => 'concurrent' },
147
+ { :name => 'Swift Storage Node',
148
+ :class => [],
149
+ :layouts => [],
150
+ :services => [:swift],
151
+ :orchestration => 'concurrent' },
152
+ { :name => 'HA Controller',
153
+ :class => [],
154
+ :layouts => [[:ha_nova, 1], [:ha_neutron, 1]],
155
+ :services => [:ha_controller, :keystone_ha, :load_balancer_ha, :memcached_ha, :qpid_ha,
156
+ :glance_ha, :nova_ha, :heat_ha, :cinder_ha, :swift_ha, :horizon_ha, :mysql_ha,
157
+ :neutron_ha, :galera_ha],
158
+ :orchestration => 'concurrent' }]
151
159
 
152
160
  CONTROLLER_ROLES = ROLES.select { |h| h.fetch(:name) =~ /Controller/ }
153
161
 
@@ -662,13 +670,15 @@ module Staypuft
662
670
 
663
671
  def seed_roles
664
672
  ROLES.each do |role_hash|
665
- role = Staypuft::Role.where(:name => role_hash[:name]).first_or_create!
673
+ role = Staypuft::Role.where(:name => role_hash[:name]).first_or_initialize
666
674
 
667
675
  puppet_classes = collect_puppet_classes(Array(role_hash[:class]))
668
676
  puppet_classes.each { |pc| apply_astapor_defaults pc }
669
677
  role.puppetclasses = puppet_classes
670
678
 
671
679
  role.description = role_hash[:description]
680
+ role.orchestration = role_hash[:orchestration]
681
+ role.save!
672
682
  old_role_services_arr = role.role_services.to_a
673
683
  role_hash[:services].each do |key|
674
684
  role_service = role.role_services.where(:service_id => SERVICES[key][:obj].id).first_or_create!
@@ -1,5 +1,16 @@
1
1
  module Staypuft
2
2
  class Role < ActiveRecord::Base
3
+ # until we have puppetssh, "run puppet" below means "provision and run puppet"
4
+
5
+ # run puppet on all nodes concurrently
6
+ ORCHESTRATION_CONCURRENT = "concurrent"
7
+ # run puppet on one node at a time
8
+ ORCHESTRATION_SERIAL = "serial"
9
+ # run puppet on the first mode, then the rest concurrently
10
+ ORCHESTRATION_LEADER = "leader"
11
+
12
+ ORCHESTRATION_MODES = [ORCHESTRATION_CONCURRENT, ORCHESTRATION_SERIAL, ORCHESTRATION_LEADER]
13
+
3
14
  has_many :layout_roles, :dependent => :destroy
4
15
  has_many :layouts, :through => :layout_roles
5
16
 
@@ -17,6 +28,8 @@ module Staypuft
17
28
 
18
29
  validates :name, :presence => true, :uniqueness => true
19
30
 
31
+ validates :orchestration, :inclusion => {:in => ORCHESTRATION_MODES }
32
+
20
33
  scope(:in_deployment, lambda do |deployment|
21
34
  joins(:deployment_role_hostgroups).
22
35
  where(DeploymentRoleHostgroup.table_name => { deployment_id: deployment })
@@ -1,12 +1,14 @@
1
1
  <% if hosts.any? %>
2
+ <h4 class="pull-left"><%= _("Assigned Hosts") %></h4>
2
3
  <div class="" id="table_assigned_hosts">
3
4
  <%= form_tag(unassign_host_deployment_path(id: @deployment), class: 'form-horizontal association', method: 'post') do |f| %>
4
5
  <div class="pull-right top_actions">
5
- <%= submit_tag _("Configure Networks"), :class => "btn btn-default btn-sm", :style => "visibility: hidden" %>
6
- <%= submit_tag _("Unassign Hosts"), :class => "btn btn-primary btn-sm", :disabled => true, :id => "unassign_hosts_button" %>
6
+ <%= render partial: "hosts_filter" %>
7
+ <div class="pull-right">
8
+ <%= submit_tag _("Configure Networks"), :class => "btn btn-default btn-sm", :style => "visibility: hidden" %>
9
+ <%= submit_tag _("Unassign Hosts"), :class => "btn btn-primary btn-sm", :disabled => true, :id => "unassign_hosts_button" %>
10
+ </div>
7
11
  </div>
8
- <h4 class="pull-left"><%= _("Assigned Hosts") %></h4>
9
- <p class="clearfix"></p>
10
12
  <table class="table table-bordered table-striped table-condensed">
11
13
  <thead>
12
14
  <tr>
@@ -21,7 +23,7 @@
21
23
  <th class="hidden-s hidden-xs"><%= sort :ip, :as => _('IP Address') %></th>
22
24
  </tr>
23
25
  </thead>
24
- <tbody>
26
+ <tbody class="searchable">
25
27
  <% hosts.each do |host| %>
26
28
  <tr class="checkbox_highlight">
27
29
  <td class="ca">
@@ -1,17 +1,19 @@
1
1
  <% if hosts.any? %>
2
+ <h4 class="pull-left"><%= _("Deployed Hosts") %></h4>
2
3
  <div class="" id="table_deployed_hosts">
3
4
  <%= form_tag(associate_host_deployment_path(id: @deployment), class: 'form-horizontal association') do |f| %>
4
5
  <div class="pull-right top_actions">
5
- <%= submit_tag _("Unassign Hosts"),
6
- :class => "btn btn-danger btn-sm pull-right",
7
- :'data-toggle' => "tooltip",
8
- :'data-placement' => "left",
9
- :id => "undeploy_hosts_modal",
10
- :disabled => true,
11
- :title => _("Unassigning deployed hosts may lead to unexpected problems.") %>
6
+ <%= render partial: "hosts_filter" %>
7
+ <div class="pull-right">
8
+ <%= submit_tag _("Unassign Hosts"),
9
+ :class => "btn btn-danger btn-sm",
10
+ :'data-toggle' => "tooltip",
11
+ :'data-placement' => "left",
12
+ :id => "undeploy_hosts_modal",
13
+ :disabled => true,
14
+ :title => _("Unassigning deployed hosts may lead to unexpected problems.") %>
15
+ </div>
12
16
  </div>
13
- <h4 class="pull-left"><%= _("Deployed Hosts") %></h4>
14
- <p class="clearfix"></p>
15
17
  <table class="table table-bordered table-striped table-condensed">
16
18
  <thead>
17
19
  <tr>
@@ -25,7 +27,7 @@
25
27
  <th><%= _("Last Report") %></th>
26
28
  </tr>
27
29
  </thead>
28
- <tbody>
30
+ <tbody class="searchable">
29
31
  <% hosts.each do |host| %>
30
32
  <tr class="checkbox_highlight">
31
33
  <td class="ca">
@@ -1,14 +1,16 @@
1
1
  <% if hosts.exists? %>
2
+ <h4 class="pull-left"><%= _("Free Hosts") %></h4>
2
3
  <div class="" id="table_free_hosts">
3
4
  <%= form_tag(associate_host_deployment_path(id: @deployment), class: 'form-horizontal association') do |f| %>
4
5
  <div class="pull-right top_actions">
5
- <%= submit_tag _("Configure Networks"), :class => "btn btn-default btn-sm", :style => "visibility: hidden" %>
6
- <button type="button" class= "btn btn-primary btn-sm"
7
- id="assign_hosts_modal" data-toggle = "modal"
8
- data-target = "#role_modal" disabled="true"><%= _("Assign Hosts") %></button>
6
+ <%= render partial: "hosts_filter" %>
7
+ <div class="pull-right">
8
+ <%= submit_tag _("Configure Networks"), :class => "btn btn-default btn-sm", :style => "visibility: hidden" %>
9
+ <button type="button" class= "btn btn-primary btn-sm"
10
+ id="assign_hosts_modal" data-toggle = "modal"
11
+ data-target = "#role_modal" disabled="true"><%= _("Assign Hosts") %></button>
12
+ </div>
9
13
  </div>
10
- <h4 class="pull-left"><%= _("Free Hosts") %></h4>
11
- <p class="clearfix"></p>
12
14
  <table class="table table-bordered table-striped table-condensed">
13
15
  <thead>
14
16
  <tr>
@@ -23,7 +25,7 @@
23
25
  <th class="hidden-s hidden-xs"><%= sort :ip, :as => _('IP Address') %></th>
24
26
  </tr>
25
27
  </thead>
26
- <tbody>
28
+ <tbody class="searchable">
27
29
  <% hosts.each do |host| %>
28
30
  <tr class="checkbox_highlight">
29
31
  <td class="ca">
@@ -0,0 +1,3 @@
1
+ <div class="input-group col-md-4 pull-left"> <span class="input-group-addon">Filter</span>
2
+ <input id="" type="text" class="form-control hosts_filter" placeholder="Type here...">
3
+ </div>
@@ -0,0 +1,5 @@
1
+ class AddOrchestrationToStaypuftRole < ActiveRecord::Migration
2
+ def change
3
+ add_column :staypuft_roles, :orchestration, :string
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
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.2.5
4
+ version: 0.2.6
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-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks
@@ -147,6 +147,7 @@ files:
147
147
  - app/views/staypuft/deployments/_deployment_overview.html.erb
148
148
  - app/views/staypuft/deployments/_deployment_progress_page_header.html.erb
149
149
  - app/views/staypuft/deployments/_free_hosts_table.html.erb
150
+ - app/views/staypuft/deployments/_hosts_filter.html.erb
150
151
  - app/views/staypuft/deployments/_assigned_hosts.html.erb
151
152
  - app/views/staypuft/deployments/_deployment_hosts.html.erb
152
153
  - app/views/staypuft/deployments/show.html.erb
@@ -170,6 +171,7 @@ files:
170
171
  - db/migrate/20140309021811_create_staypuft_layouts.rb
171
172
  - db/migrate/20140310174152_create_staypuft_layout_roles.rb
172
173
  - db/migrate/20140318163222_add_deploy_order_to_staypuft_layout_role.rb
174
+ - db/migrate/20140825164900_add_orchestration_to_staypuft_role.rb
173
175
  - db/migrate/20140326032027_drop_staypuft_hostgroup_roles.rb
174
176
  - db/migrate/20140623142500_remove_amqp_provider_from_staypuft_deployment.rb
175
177
  - db/migrate/20140513124807_change_column_default_form_step_on_staypuft_deployment.rb