staypuft 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -13,7 +13,7 @@ Symlink `config/staypuft.local.rb` to yours Foreman `bundle.d`.
13
13
 
14
14
  ## Development setup
15
15
 
16
- See [this](docs/setup.md) document.
16
+ See [this](doc/setup.md) document.
17
17
 
18
18
  ## TODO
19
19
 
@@ -56,15 +56,57 @@ module Staypuft
56
56
  hostgroup = ::Hostgroup.find params[:hostgroup_id]
57
57
  hosts = Array(::Host::Base.find *params[:host_ids])
58
58
  hosts.each do |host|
59
- host = host.becomes(::Host::Managed)
60
- host.type = 'Host::Managed'
61
- host.managed = true
62
- host.build = false
63
- host.hostgroup = hostgroup
59
+ host = host.becomes(::Host::Managed)
60
+ host.attributes = { "environment_id" => "2",
61
+ "puppet_ca_proxy_id" => "1",
62
+ "puppet_proxy_id" => "1",
63
+ "puppetclass_ids" => [""],
64
+ "managed" => "true",
65
+ "type" => "Host::Managed",
66
+ "domain_id" => "1",
67
+ "subnet_id" => "2",
68
+ "interfaces_attributes" =>
69
+ { "new_interfaces" =>
70
+ { "_destroy" => "false",
71
+ "type" => "Nic::Managed",
72
+ "mac" => "",
73
+ "name" => "",
74
+ "domain_id" => "",
75
+ "ip" => "",
76
+ "provider" => "IPMI" } },
77
+ "architecture_id" => "1",
78
+ "operatingsystem_id" => "2",
79
+ "provision_method" => "build",
80
+ "build" => "0",
81
+ "medium_id" => "7",
82
+ "ptable_id" => "6",
83
+ "disk" => "",
84
+ "root_pass" => "",
85
+ "enabled" => "1",
86
+ "overwrite" => "false" }
87
+ # host.type = 'Host::Managed'
88
+ # # host.name = 'a' + rand(1000).to_s
89
+ # host.managed = true
90
+ # host.build = true
91
+ host.hostgroup_id = hostgroup.id
64
92
  host.save!
93
+ #
94
+ # host.build = false
95
+ # host.save!
65
96
  end
66
97
  redirect_to deployment_path(id: ::Staypuft::Deployment.first)
67
98
  end
68
99
 
69
100
  end
101
+
102
+ def self.test
103
+ User.current = User.first
104
+ discovered = Host::Discovered.first
105
+ host = discovered.becomes Host::Managed
106
+ hostgroup = Hostgroup.find(17)
107
+ host.hostgroup = hostgroup
108
+ p host.name
109
+ $host = host
110
+ host.save!
111
+ end
70
112
  end
@@ -0,0 +1,50 @@
1
+ #
2
+ # Copyright 2014 Red Hat, Inc.
3
+ #
4
+ # This software is licensed to you under the GNU General Public
5
+ # License as published by the Free Software Foundation; either version
6
+ # 2 of the License (GPLv2) or (at your option) any later version.
7
+ # There is NO WARRANTY for this software, express or implied,
8
+ # including the implied warranties of MERCHANTABILITY,
9
+ # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
10
+ # have received a copy of GPLv2 along with this software; if not, see
11
+ # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
12
+
13
+ module Actions
14
+ module Staypuft
15
+ module Host
16
+
17
+ # creates and provisions Host waiting until it's ready
18
+ class Provision < Actions::Base
19
+
20
+ middleware.use Actions::Staypuft::Middleware::AsCurrentUser
21
+
22
+ def plan(name, hostgroup, compute_resource)
23
+ Type! hostgroup, ::Hostgroup
24
+ Type! compute_resource, ComputeResource
25
+
26
+ input[:name] = name
27
+
28
+ sequence do
29
+ creation = plan_action Host::Create, name, hostgroup, compute_resource
30
+ plan_action Host::Build, creation.output[:host][:id]
31
+ plan_action Host::WaitUntilInstalled, creation.output[:host][:id]
32
+ # TODO: wait until restarted
33
+ end
34
+ end
35
+
36
+ def humanized_input
37
+ input[:name]
38
+ end
39
+
40
+ def task_output
41
+ planned_actions(Host::Create).first.output
42
+ end
43
+
44
+ def humanized_output
45
+ task_output.fetch(:host, {})[:name]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -60,6 +60,24 @@ module Actions
60
60
  fail(::Staypuft::Exception, "Latest Puppet Run Contains Failures for Host: #{host.id}")
61
61
  end
62
62
  end
63
+
64
+ def host_ready?(host_id)
65
+ host = ::Host.find(host_id)
66
+ host.reports.order('reported_at DESC').any? do |report|
67
+ check_for_failures(report)
68
+ report_change?(report)
69
+ end
70
+ end
71
+
72
+ def report_change?(report)
73
+ report.status['applied'] > 0
74
+ end
75
+
76
+ def check_for_failures(report)
77
+ #if report.status['failed'] > 0
78
+ # fail(::Staypuft::Exception, "Latest Puppet Run Contains Failures for Host with Report: #{report.id}")
79
+ #end
80
+ end
63
81
  end
64
82
  end
65
83
  end
@@ -50,7 +50,7 @@ module Staypuft::Concerns::HostgroupExtensions
50
50
 
51
51
  module ClassMethods
52
52
  Gem::Version.new(SETTINGS[:version].to_s.gsub(/-develop$/, '')) < Gem::Version.new('1.5') or
53
- raise 'remove nest method, nesting Hostgroups is fixed in Foreman 1.5, use just parent_id'
53
+ Rails.logger.warn 'remove nest method, nesting Hostgroups is fixed in Foreman 1.5, use just parent_id'
54
54
 
55
55
  def nest(name, parent)
56
56
  new = parent.dup
@@ -32,9 +32,12 @@
32
32
  <% @deployment.child_hostgroups.each_with_index do |child_hostgroup, i| %>
33
33
  <li class="<%= 'active' if i == 0 %>">
34
34
  <a href="#<%= child_hostgroup.name.parameterize.underscore %>" data-toggle="tab" class="roles_list">
35
- <div class="col-xs-2 text-center"><span class="glyphicon glyphicon-ok"></span><span>0</span></div>
36
- <div class="col-xs-2 text-center"><span class="glyphicon glyphicon-warning-sign"></span><span>0</span></div>
37
- <div class="col-xs-2 text-center"><span class="glyphicon glyphicon-time"></span><span>0</span></div>
35
+ <div class="col-xs-2 text-center">
36
+ <span class="glyphicon glyphicon-ok"></span><span>0</span></div>
37
+ <div class="col-xs-2 text-center">
38
+ <span class="glyphicon glyphicon-warning-sign"></span><span>0</span></div>
39
+ <div class="col-xs-2 text-center">
40
+ <span class="glyphicon glyphicon-time"></span><span>0</span></div>
38
41
  <div class="col-xs-6"><%= child_hostgroup.name %></div>
39
42
  <span class="clearfix"></span>
40
43
  </a>
data/db/seeds.rb CHANGED
@@ -39,6 +39,7 @@ params = {
39
39
  "neutron_user_password" => SecureRandom.hex,
40
40
  "nova_db_password" => SecureRandom.hex,
41
41
  "nova_user_password" => SecureRandom.hex,
42
+ "nova_default_floating_pool" => "nova",
42
43
  "swift_admin_password" => SecureRandom.hex,
43
44
  "swift_shared_secret" => SecureRandom.hex,
44
45
  "swift_all_ips" => ['192.168.203.1', '192.168.203.2', '192.168.203.3', '192.168.203.4'],
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = "0.0.2"
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,69 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staypuft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Staypuft team
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
12
+ date: 2014-04-07 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: foreman-tasks
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
- name: wicked
31
+ name: dynflow
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ~>
32
36
  - !ruby/object:Gem::Version
33
- version: '0'
37
+ version: 0.6.1
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ~>
39
44
  - !ruby/object:Gem::Version
40
- version: '0'
45
+ version: 0.6.1
41
46
  - !ruby/object:Gem::Dependency
42
- name: oj
47
+ name: wicked
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: foreman_discovery
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: OpenStack Foreman Installer
@@ -73,62 +82,63 @@ executables: []
73
82
  extensions: []
74
83
  extra_rdoc_files: []
75
84
  files:
76
- - app/helpers/staypuft/application_helper.rb
77
- - app/helpers/staypuft/deployments_helper.rb
78
85
  - app/assets/javascripts/staypuft/staypuft.js
79
- - app/assets/stylesheets/staypuft/staypuft.css.scss
80
86
  - app/assets/stylesheets/staypuft/bootstrap_and_overrides.css.scss
81
- - app/models/staypuft/service.rb
82
- - app/models/staypuft/role_class.rb
83
- - app/models/staypuft/deployment.rb
84
- - app/models/staypuft/role_service.rb
85
- - app/models/staypuft/deployment_role_hostgroup.rb
86
- - app/models/staypuft/layout.rb
87
- - app/models/staypuft/service_class.rb
87
+ - app/assets/stylesheets/staypuft/staypuft.css.scss
88
+ - app/controllers/staypuft/application_controller.rb
89
+ - app/controllers/staypuft/deployment_steps_controller.rb
90
+ - app/controllers/staypuft/deployments_controller.rb
91
+ - app/helpers/staypuft/application_helper.rb
92
+ - app/helpers/staypuft/deployments_helper.rb
93
+ - app/lib/actions/staypuft/deployment/deploy.rb
94
+ - app/lib/actions/staypuft/deployment/populate.rb
95
+ - app/lib/actions/staypuft/host/build.rb
96
+ - app/lib/actions/staypuft/host/create.rb
97
+ - app/lib/actions/staypuft/host/deploy.rb
98
+ - app/lib/actions/staypuft/host/provision.rb
99
+ - app/lib/actions/staypuft/host/puppet_run.rb
100
+ - app/lib/actions/staypuft/host/wait_until_host_ready.rb
101
+ - app/lib/actions/staypuft/host/wait_until_installed.rb
102
+ - app/lib/actions/staypuft/hostgroup/deploy.rb
103
+ - app/lib/actions/staypuft/hostgroup/ordered_deploy.rb
104
+ - app/lib/actions/staypuft/middleware/as_current_user.rb
105
+ - app/lib/staypuft/exception.rb
106
+ - app/models/settings/staypuft.rb
88
107
  - app/models/staypuft/concerns/host_orchestration_build_hook.rb
89
108
  - app/models/staypuft/concerns/hostgroup_extensions.rb
90
109
  - app/models/staypuft/concerns/puppetclass_extensions.rb
110
+ - app/models/staypuft/deployment.rb
111
+ - app/models/staypuft/deployment_role_hostgroup.rb
112
+ - app/models/staypuft/layout.rb
91
113
  - app/models/staypuft/layout_role.rb
92
114
  - app/models/staypuft/role.rb
93
- - app/models/settings/staypuft.rb
94
- - app/lib/staypuft/exception.rb
95
- - app/lib/actions/staypuft/middleware/as_current_user.rb
96
- - app/lib/actions/staypuft/hostgroup/deploy.rb
97
- - app/lib/actions/staypuft/hostgroup/ordered_deploy.rb
98
- - app/lib/actions/staypuft/host/deploy.rb
99
- - app/lib/actions/staypuft/host/build.rb
100
- - app/lib/actions/staypuft/host/wait_until_host_ready.rb
101
- - app/lib/actions/staypuft/host/puppet_run.rb
102
- - app/lib/actions/staypuft/host/create.rb
103
- - app/lib/actions/staypuft/host/wait_until_installed.rb
104
- - app/lib/actions/staypuft/deployment/deploy.rb
105
- - app/lib/actions/staypuft/deployment/populate.rb
106
- - app/controllers/staypuft/deployments_controller.rb
107
- - app/controllers/staypuft/application_controller.rb
108
- - app/controllers/staypuft/deployment_steps_controller.rb
109
- - app/views/staypuft/deployments/index.html.erb
110
- - app/views/staypuft/deployments/show.html.erb
111
- - app/views/staypuft/deployment_steps/deployment_settings.html.erb
112
- - app/views/staypuft/deployment_steps/services_selection.html.erb
115
+ - app/models/staypuft/role_class.rb
116
+ - app/models/staypuft/role_service.rb
117
+ - app/models/staypuft/service.rb
118
+ - app/models/staypuft/service_class.rb
113
119
  - app/views/staypuft/deployment_steps/_title.html.erb
120
+ - app/views/staypuft/deployment_steps/deployment_settings.html.erb
114
121
  - app/views/staypuft/deployment_steps/services_configuration.html.erb
122
+ - app/views/staypuft/deployment_steps/services_selection.html.erb
123
+ - app/views/staypuft/deployments/index.html.erb
124
+ - app/views/staypuft/deployments/show.html.erb
115
125
  - app/views/staypuft/layouts/staypuft.html.erb
116
- - config/staypuft.local.rb
117
126
  - config/routes.rb
118
- - db/migrate/20140312050615_create_staypuft_role_classes.rb
127
+ - config/staypuft.local.rb
119
128
  - db/migrate/20140309021811_create_staypuft_layouts.rb
120
- - db/migrate/20140310203855_create_staypuft_role_services.rb
129
+ - db/migrate/20140310004533_create_staypuft_deployments.rb
121
130
  - db/migrate/20140310023613_create_staypuft_roles.rb
122
- - db/migrate/20140325211410_add_role_to_staypuft_deployment_role_hostgroup.rb
123
- - db/migrate/20140326032027_drop_staypuft_hostgroup_roles.rb
131
+ - db/migrate/20140310174152_create_staypuft_layout_roles.rb
124
132
  - db/migrate/20140310194221_create_staypuft_services.rb
133
+ - db/migrate/20140310203855_create_staypuft_role_services.rb
134
+ - db/migrate/20140312044533_create_staypuft_deployment_role_hostgroups.rb
125
135
  - db/migrate/20140312050001_create_staypuft_hostgroup_roles.rb
126
- - db/migrate/20140310174152_create_staypuft_layout_roles.rb
127
- - db/migrate/20140318163222_add_deploy_order_to_staypuft_layout_role.rb
128
- - db/migrate/20140315031754_add_networking_to_staypuft_layout.rb
136
+ - db/migrate/20140312050615_create_staypuft_role_classes.rb
129
137
  - db/migrate/20140312051144_create_staypuft_service_classes.rb
130
- - db/migrate/20140312044533_create_staypuft_deployment_role_hostgroups.rb
131
- - db/migrate/20140310004533_create_staypuft_deployments.rb
138
+ - db/migrate/20140315031754_add_networking_to_staypuft_layout.rb
139
+ - db/migrate/20140318163222_add_deploy_order_to_staypuft_layout_role.rb
140
+ - db/migrate/20140325211410_add_role_to_staypuft_deployment_role_hostgroup.rb
141
+ - db/migrate/20140326032027_drop_staypuft_hostgroup_roles.rb
132
142
  - db/seeds.rb
133
143
  - lib/staypuft/engine.rb
134
144
  - lib/staypuft/version.rb
@@ -137,39 +147,40 @@ files:
137
147
  - LICENSE
138
148
  - Rakefile
139
149
  - README.md
140
- - test/test_helper.rb
141
- - test/staypuft_test.rb
142
- - test/unit/staypuft_test.rb
143
- - test/integration/navigation_test.rb
144
150
  - test/factories/staypuft_factories.rb
151
+ - test/integration/navigation_test.rb
152
+ - test/staypuft_test.rb
153
+ - test/test_helper.rb
145
154
  - test/test_plugin_helper.rb
155
+ - test/unit/staypuft_test.rb
146
156
  homepage: https://github.com/theforeman/staypuft
147
157
  licenses: []
148
- metadata: {}
149
158
  post_install_message:
150
159
  rdoc_options: []
151
160
  require_paths:
152
161
  - lib
153
162
  required_ruby_version: !ruby/object:Gem::Requirement
163
+ none: false
154
164
  requirements:
155
- - - '>='
165
+ - - ! '>='
156
166
  - !ruby/object:Gem::Version
157
167
  version: '0'
158
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
+ none: false
159
170
  requirements:
160
- - - '>='
171
+ - - ! '>='
161
172
  - !ruby/object:Gem::Version
162
173
  version: '0'
163
174
  requirements: []
164
175
  rubyforge_project:
165
- rubygems_version: 2.0.3
176
+ rubygems_version: 1.8.23
166
177
  signing_key:
167
- specification_version: 4
178
+ specification_version: 3
168
179
  summary: OpenStack Foreman Installer
169
180
  test_files:
170
- - test/test_helper.rb
171
- - test/staypuft_test.rb
172
- - test/unit/staypuft_test.rb
173
- - test/integration/navigation_test.rb
174
181
  - test/factories/staypuft_factories.rb
182
+ - test/integration/navigation_test.rb
183
+ - test/staypuft_test.rb
184
+ - test/test_helper.rb
175
185
  - test/test_plugin_helper.rb
186
+ - test/unit/staypuft_test.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 63e9f17728bf3ff2084000a2eb08f08d68340c87
4
- data.tar.gz: 9d7e070d3e2055b448de53c39dbaa5c7f8830232
5
- SHA512:
6
- metadata.gz: 167c564e5be0f73cb35f04292e2ac98f0bf515c8d5cbf2070e87d3fccb9ad948fbc7fb087897c7a8692fe495518219b493408e21339ed77db2edcd00440ac39c
7
- data.tar.gz: dd33319c9a552308e5ed909038140494c2c0d07304d1016eaf24175956c1b9c6922a03e0615bec1137f043b5299b3a89f2f958988fdfd9dd55f272502b2176c3