staypuft 0.0.11 → 0.0.12
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 +4 -4
- data/README.md +0 -8
- data/app/controllers/staypuft/deployment_steps_controller.rb +4 -4
- data/app/controllers/staypuft/deployments_controller.rb +41 -28
- data/app/helpers/staypuft/deployments_helper.rb +1 -1
- data/app/lib/actions/staypuft/deployment/deploy.rb +1 -5
- data/app/lib/actions/staypuft/deployment/populate.rb +0 -13
- data/app/models/staypuft/concerns/hostgroup_extensions.rb +3 -0
- data/app/models/staypuft/deployment.rb +20 -8
- data/app/models/staypuft/service.rb +8 -5
- data/app/views/staypuft/deployment_steps/services_selection.html.erb +1 -1
- data/app/views/staypuft/deployments/show.html.erb +18 -5
- data/db/seeds.rb +1 -0
- data/lib/staypuft/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54176ed2876a5cfe10a15aa19cbfdbf35d89d8a1
|
4
|
+
data.tar.gz: 3fc002583ba2458fd7cf9c41a592c77f533023d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34345fe56f017bc92e93c906ee7608aa6a0a6518522b39961153287ab8ef7bc91f0eb382410c124fdd30b1d51d8f42cb7f6e57ca4ab006668361f832ad649476
|
7
|
+
data.tar.gz: f1a524875345eff51897ebc887811d3164d58404e1f55abce6b522c71d9a84bbee8a483ef429db09218b3087dbf11d6f85ac149af674830a735f6d00fa6b7b4d
|
data/README.md
CHANGED
@@ -15,14 +15,6 @@ Symlink `config/staypuft.local.rb` to yours Foreman `bundle.d`.
|
|
15
15
|
|
16
16
|
See [this](doc/setup.md) document.
|
17
17
|
|
18
|
-
## TODO
|
19
|
-
|
20
|
-
Much to do:
|
21
|
-
* UI For launching a basic provisioning workflow,
|
22
|
-
* Deploy a 3-controller HA configuration,
|
23
|
-
* Configure an HA OpenStack deployment with three controller nodes and as many compute and storage nodes as are required,
|
24
|
-
* Configure an OpenStack deployment with a single controller node.
|
25
|
-
|
26
18
|
## Contributing
|
27
19
|
|
28
20
|
Fork and send a Pull Request. Thanks!
|
@@ -10,7 +10,7 @@ module Staypuft
|
|
10
10
|
when :deployment_settings
|
11
11
|
@layouts = ordered_layouts
|
12
12
|
when :services_configuration
|
13
|
-
@services = @deployment.services
|
13
|
+
@services = @deployment.services.order(:name)
|
14
14
|
end
|
15
15
|
|
16
16
|
render_wizard
|
@@ -33,10 +33,10 @@ module Staypuft
|
|
33
33
|
end
|
34
34
|
when :services_configuration
|
35
35
|
# Collect services across all deployment's roles
|
36
|
-
@services = @deployment.
|
36
|
+
@services = @deployment.services.order(:name)
|
37
37
|
if params[:staypuft_deployment]
|
38
38
|
param_data = params[:staypuft_deployment][:hostgroup_params]
|
39
|
-
diffs
|
39
|
+
diffs = []
|
40
40
|
param_data.each do |hostgroup_id, hostgroup_params|
|
41
41
|
hostgroup = Hostgroup.find(hostgroup_id)
|
42
42
|
hostgroup_params[:puppetclass_params].each do |puppetclass_id, puppetclass_params|
|
@@ -54,7 +54,7 @@ module Staypuft
|
|
54
54
|
|
55
55
|
private
|
56
56
|
def get_deployment
|
57
|
-
@deployment
|
57
|
+
@deployment = Deployment.first
|
58
58
|
@deployment.name = nil if @deployment.name.starts_with?(Deployment::NEW_NAME_PREFIX)
|
59
59
|
end
|
60
60
|
|
@@ -63,34 +63,18 @@ module Staypuft
|
|
63
63
|
hosts_to_assign = targeted_hosts - assigned_hosts
|
64
64
|
hosts_to_remove = assigned_hosts - targeted_hosts
|
65
65
|
|
66
|
-
hosts_to_assign.
|
67
|
-
|
68
|
-
host
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
host.root_pass = hostgroup.root_pass
|
79
|
-
|
80
|
-
# I do not why but the final save! adds following condytion to the update SQL command
|
81
|
-
# "WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 283"
|
82
|
-
# which will not find the record since it's still Host::Discovered.
|
83
|
-
# Using #update_column to change it directly in DB
|
84
|
-
# (discovered_host is used to avoid same WHERE condition problem here).
|
85
|
-
# FIXME this is definitely ugly, needs to be properly fixed
|
86
|
-
discovered_host.update_column :type, 'Host::Managed'
|
87
|
-
|
88
|
-
begin
|
89
|
-
host.save!
|
90
|
-
rescue => e
|
91
|
-
discovered_host.update_column :type, original_type
|
92
|
-
raise e
|
93
|
-
end
|
66
|
+
unassigned_hosts = hosts_to_assign.reduce([]) do |unassigned_hosts, discovered_host|
|
67
|
+
success, host = assign_host_to_hostgroup discovered_host, hostgroup
|
68
|
+
success ? unassigned_hosts : [*unassigned_hosts, host]
|
69
|
+
end
|
70
|
+
|
71
|
+
unless unassigned_hosts.empty?
|
72
|
+
flash[:warning] = 'Unassigned hosts: ' + unassigned_hosts.map(&:name_was).join(', ')
|
73
|
+
Rails.logger.warn(
|
74
|
+
"Unassigned hosts: \n" +
|
75
|
+
unassigned_hosts.
|
76
|
+
map { |h| format '%s (%s)', h.name_was, h.errors.full_messages.join(',') }.
|
77
|
+
join("\n"))
|
94
78
|
end
|
95
79
|
|
96
80
|
hosts_to_remove.each do |host|
|
@@ -100,6 +84,35 @@ module Staypuft
|
|
100
84
|
|
101
85
|
redirect_to deployment_path(id: ::Staypuft::Deployment.first)
|
102
86
|
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def assign_host_to_hostgroup(discovered_host, hostgroup)
|
91
|
+
original_type = discovered_host.type
|
92
|
+
host = discovered_host.becomes(::Host::Managed)
|
93
|
+
host.type = 'Host::Managed'
|
94
|
+
host.managed = true
|
95
|
+
host.build = true
|
96
|
+
|
97
|
+
host.hostgroup = hostgroup
|
98
|
+
# set discovery environment to keep booting discovery image
|
99
|
+
host.environment = Environment.get_discovery
|
100
|
+
|
101
|
+
# root_pass is not copied for some reason
|
102
|
+
host.root_pass = hostgroup.root_pass
|
103
|
+
|
104
|
+
# I do not why but the final save! adds following condytion to the update SQL command
|
105
|
+
# "WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 283"
|
106
|
+
# which will not find the record since it's still Host::Discovered.
|
107
|
+
# Using #update_column to change it directly in DB
|
108
|
+
# (discovered_host is used to avoid same WHERE condition problem here).
|
109
|
+
# FIXME this is definitely ugly, needs to be properly fixed
|
110
|
+
discovered_host.update_column :type, 'Host::Managed'
|
111
|
+
|
112
|
+
[host.save, host].tap do |saved, _|
|
113
|
+
discovered_host.becomes(Host::Base).update_column(:type, original_type) unless saved
|
114
|
+
end
|
115
|
+
end
|
103
116
|
end
|
104
117
|
|
105
118
|
end
|
@@ -14,7 +14,7 @@ module Staypuft
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def alert_if_deployed
|
17
|
-
if @deployment.
|
17
|
+
if @deployment.deployed?
|
18
18
|
(alert :class => 'alert-warning',
|
19
19
|
:text => _('Machines are already deployed with this configuration. Changing the configuration parameters
|
20
20
|
is unsupported and may result in an unusable configuration. <br/>Please proceed with caution.'),
|
@@ -21,12 +21,8 @@ module Actions
|
|
21
21
|
def plan(deployment)
|
22
22
|
Type! deployment, ::Staypuft::Deployment
|
23
23
|
|
24
|
-
ordered_hostgroups = deployment.child_hostgroups.
|
25
|
-
reorder("#{::Staypuft::DeploymentRoleHostgroup.table_name}.deploy_order").to_a
|
26
24
|
input.update id: deployment.id, name: deployment.name
|
27
|
-
|
28
|
-
plan_action Hostgroup::OrderedDeploy, ordered_hostgroups
|
29
|
-
|
25
|
+
plan_action Hostgroup::OrderedDeploy, deployment.child_hostgroups.deploy_order.to_a
|
30
26
|
lock! deployment
|
31
27
|
end
|
32
28
|
|
@@ -29,10 +29,6 @@ module Actions
|
|
29
29
|
Type! compute_resource, *[ComputeResource, (NilClass if fake)].compact
|
30
30
|
|
31
31
|
sequence do
|
32
|
-
plan_self deployment_id: deployment.id,
|
33
|
-
deployment_name: deployment.name,
|
34
|
-
fake: fake,
|
35
|
-
assign: assign
|
36
32
|
|
37
33
|
hostgroups = deployment.child_hostgroups
|
38
34
|
hostgroups.each do |hostgroup|
|
@@ -47,15 +43,6 @@ module Actions
|
|
47
43
|
end
|
48
44
|
end
|
49
45
|
|
50
|
-
def run
|
51
|
-
deployment = ::Staypuft::Deployment.find input.fetch(:deployment_id)
|
52
|
-
hostgroups = deployment.child_hostgroups
|
53
|
-
hostgroups.each do |hostgroup|
|
54
|
-
hostgroup.hosts.each do |host|
|
55
|
-
host.destroy # TODO make action for it
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
46
|
|
60
47
|
def humanized_input
|
61
48
|
"#{input[:deployment_name]} #{input[:fake] ? 'fake' : 'real'}"
|
@@ -7,6 +7,9 @@ module Staypuft::Concerns::HostgroupExtensions
|
|
7
7
|
has_one :role, :through => :deployment_role_hostgroup, :class_name => 'Staypuft::Role'
|
8
8
|
|
9
9
|
has_one :deployment, :class_name => 'Staypuft::Deployment'
|
10
|
+
|
11
|
+
scope :deploy_order,
|
12
|
+
lambda { reorder "#{::Staypuft::DeploymentRoleHostgroup.table_name}.deploy_order" }
|
10
13
|
end
|
11
14
|
|
12
15
|
def add_puppetclasses_from_resource(resource)
|
@@ -10,9 +10,17 @@ module Staypuft
|
|
10
10
|
belongs_to :hostgroup, :dependent => :destroy
|
11
11
|
|
12
12
|
has_many :deployment_role_hostgroups, :dependent => :destroy
|
13
|
-
has_many :child_hostgroups,
|
14
|
-
|
15
|
-
|
13
|
+
has_many :child_hostgroups,
|
14
|
+
:through => :deployment_role_hostgroups,
|
15
|
+
:class_name => 'Hostgroup',
|
16
|
+
:source => :hostgroup
|
17
|
+
|
18
|
+
has_many :roles,
|
19
|
+
:through => :deployment_role_hostgroups
|
20
|
+
has_many :roles_ordered,
|
21
|
+
:through => :deployment_role_hostgroups,
|
22
|
+
:source => :role,
|
23
|
+
:order => "#{::Staypuft::DeploymentRoleHostgroup.table_name}.deploy_order"
|
16
24
|
|
17
25
|
has_many :services, :through => :roles
|
18
26
|
has_many :hosts, :through => :child_hostgroups
|
@@ -69,16 +77,20 @@ module Staypuft
|
|
69
77
|
def set_networking_params
|
70
78
|
child_hostgroups.each do |the_hostgroup|
|
71
79
|
the_hostgroup.puppetclasses.each do |pclass|
|
72
|
-
if pclass.class_params.where(:key=> "include_neutron").first
|
80
|
+
if pclass.class_params.where(:key => "include_neutron").first
|
73
81
|
the_hostgroup.set_param_value_if_changed(pclass, "include_neutron",
|
74
|
-
|
82
|
+
layout.networking == 'neutron')
|
75
83
|
end
|
76
|
-
if pclass.class_params.where(:key=> "neutron").first
|
84
|
+
if pclass.class_params.where(:key => "neutron").first
|
77
85
|
the_hostgroup.set_param_value_if_changed(pclass, "neutron",
|
78
|
-
|
86
|
+
layout.networking == 'neutron')
|
79
87
|
end
|
80
88
|
end
|
81
|
-
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def deployed?
|
93
|
+
self.hosts.any?(&:open_stack_deployed?)
|
82
94
|
end
|
83
95
|
|
84
96
|
private
|
@@ -15,7 +15,7 @@ module Staypuft
|
|
15
15
|
# for a param name, an array of [param_name, puppetclass] in the case where
|
16
16
|
# there are possibly multiple puppetclass matches. without this, we'll
|
17
17
|
# just grab the first puppetclass from the matching hostgroup
|
18
|
-
UI_PARAMS = {
|
18
|
+
UI_PARAMS = {
|
19
19
|
"qpid (non-HA)"=> ["qpid_ca", "qpid_cert", "qpid_host", "qpid_key", "qpid_nssdb_password"],
|
20
20
|
"MySQL"=> ["mysql_ca", "mysql_cert", "mysql_host", "mysql_key",
|
21
21
|
"mysql_root_password"],
|
@@ -53,8 +53,9 @@ module Staypuft
|
|
53
53
|
"Cinder"=> ["cinder_backend_gluster", "cinder_backend_iscsi",
|
54
54
|
"cinder_db_password", "cinder_gluster_servers",
|
55
55
|
"cinder_gluster_volume", "cinder_user_password"],
|
56
|
-
"Heat"=> ["heat_cfn", "heat_cloudwatch", "heat_db_password", "heat_user_password"],
|
57
|
-
"Ceilometer"=> ["
|
56
|
+
"Heat"=> ["heat_cfn", "heat_cloudwatch", "heat_db_password", "heat_user_password", "heat_auth_encrypt_key"],
|
57
|
+
"Ceilometer"=> ["ceilometer", "ceilometer_host",
|
58
|
+
"ceilometer_metering_secret", "ceilometer_user_password"
|
58
59
|
],
|
59
60
|
"Neutron - L3" => ["controller_priv_host", "enable_tunneling",
|
60
61
|
"external_network_bridge", "fixed_network_range",
|
@@ -68,16 +69,18 @@ module Staypuft
|
|
68
69
|
"ovs_tunnel_iface", "ovs_tunnel_network", "ovs_tunnel_types",
|
69
70
|
"ovs_vlan_ranges", "ovs_vxlan_udp_port" ],
|
70
71
|
"Nova-compute" => ["admin_password", "auto_assign_floating_ip",
|
72
|
+
"ceilometer", "ceilometer_host",
|
71
73
|
"ceilometer_metering_secret", "ceilometer_user_password",
|
72
74
|
"cinder_backend_gluster", "controller_priv_host",
|
73
75
|
"controller_pub_host", "fixed_network_range",
|
74
76
|
"floating_network_range", "mysql_ca", "mysql_host",
|
75
77
|
"nova_db_password", "network_private_iface",
|
76
|
-
"network_private_network",
|
78
|
+
"network_private_network",
|
77
79
|
"network_public_iface",
|
78
80
|
"network_public_network", "nova_user_password",
|
79
81
|
"qpid_host", "ssl", "verbose", "use_qemu_for_poc"],
|
80
|
-
"Neutron-compute" => ["admin_password", "
|
82
|
+
"Neutron-compute" => ["admin_password", "ceilometer", "ceilometer_host",
|
83
|
+
"ceilometer_metering_secret",
|
81
84
|
"ceilometer_user_password", "cinder_backend_gluster",
|
82
85
|
"controller_admin_host", "controller_priv_host",
|
83
86
|
"controller_pub_host", "enable_tunneling", "mysql_ca",
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<h4><%= "#{@deployment.layout.name} - #{@deployment.layout.networking.capitalize} " + _("Networking") %></h4>
|
10
10
|
|
11
11
|
<div class="clearfix">
|
12
|
-
<% @deployment.
|
12
|
+
<% @deployment.roles_ordered.each do |role| %>
|
13
13
|
<div class="panel panel-default service-box">
|
14
14
|
<div class="panel-heading"><strong><%= role.name %></strong></div>
|
15
15
|
<div class="panel-body">
|
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
<% content_for(:title_actions) do %>
|
4
4
|
|
5
|
-
<%= link_to(_("Edit"),
|
5
|
+
<%= link_to(_("Edit"), if @deployment.deployed?
|
6
|
+
deployment_step_path(id: 'services_configuration')
|
7
|
+
else
|
8
|
+
deployment_steps_path
|
9
|
+
end) %>
|
6
10
|
<%= link_to(_("Configuration Summary"), summary_deployment_path(@deployment.id), :class => '') %>
|
7
11
|
|
8
12
|
<% if Rails.env.development? %>
|
@@ -33,7 +37,7 @@
|
|
33
37
|
<% else %>
|
34
38
|
<%= link_to(_("Deploy"),
|
35
39
|
"",
|
36
|
-
:class
|
40
|
+
:class => %w(btn btn-success),
|
37
41
|
:'data-toggle' => "modal",
|
38
42
|
:'data-target' => "#deploy_modal") %>
|
39
43
|
<% end %>
|
@@ -43,7 +47,7 @@
|
|
43
47
|
<div class="row tabbed_side_nav_table">
|
44
48
|
<ul class="nav nav-pills nav-stacked col-md-4" data-tabs="pills">
|
45
49
|
<h3><%= _("Host Groups") %></h3>
|
46
|
-
<% @deployment.child_hostgroups.each_with_index do |child_hostgroup, i| %>
|
50
|
+
<% @deployment.child_hostgroups.deploy_order.each_with_index do |child_hostgroup, i| %>
|
47
51
|
<li class="<%= 'active' if i == 0 %>">
|
48
52
|
<a href="#<%= child_hostgroup.name.parameterize.underscore %>" data-toggle="tab" class="roles_list">
|
49
53
|
<div class="col-xs-2 text-center">
|
@@ -66,7 +70,7 @@
|
|
66
70
|
</ul>
|
67
71
|
|
68
72
|
<div class="tab-content col-md-8">
|
69
|
-
<% @deployment.child_hostgroups.each_with_index do |child_hostgroup, i| %>
|
73
|
+
<% @deployment.child_hostgroups.deploy_order.each_with_index do |child_hostgroup, i| %>
|
70
74
|
<div class="tab-pane <%= 'active' if i == 0 %>" id="<%= child_hostgroup.name.parameterize.underscore %>">
|
71
75
|
<h3><%= _("Hosts") %></h3>
|
72
76
|
<% if child_hostgroup.own_and_free_hosts.present? %>
|
@@ -97,7 +101,16 @@
|
|
97
101
|
:disabled => host.open_stack_deployed? %>
|
98
102
|
<%= hidden_field_tag 'host_ids[]', host.id if host.open_stack_deployed? %>
|
99
103
|
</td>
|
100
|
-
<td class="ellipsis"
|
104
|
+
<td class="ellipsis">
|
105
|
+
<% case host %>
|
106
|
+
<% when Host::Managed %>
|
107
|
+
<%= link_to_if_authorized host.name, hash_for_host_path(host) %>
|
108
|
+
<% when Host::Discovered %>
|
109
|
+
<%= link_to_if_authorized host.name, hash_for_discover_path(host) %>
|
110
|
+
<% else %>
|
111
|
+
<%= host.name %>
|
112
|
+
<% end %>
|
113
|
+
</td>
|
101
114
|
<td class="hidden-s hidden-xs"><%= host.mac %></td>
|
102
115
|
<td class="hidden-s hidden-xs"><%= host.type %></td>
|
103
116
|
</tr>
|
data/db/seeds.rb
CHANGED
@@ -34,6 +34,7 @@ params = {
|
|
34
34
|
"heat_db_password" => SecureRandom.hex,
|
35
35
|
"heat_user_password" => SecureRandom.hex,
|
36
36
|
"heat_cfn_user_password" => SecureRandom.hex,
|
37
|
+
"heat_auth_encrypt_key" => SecureRandom.hex,
|
37
38
|
"horizon_secret_key" => SecureRandom.hex,
|
38
39
|
"keystone_admin_token" => SecureRandom.hex,
|
39
40
|
"keystone_db_password" => SecureRandom.hex,
|
data/lib/staypuft/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.12
|
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-
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman-tasks
|