foreman_cpp_cloudstack 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +48 -0
- data/Rakefile +7 -0
- data/app/models/concerns/fog_extensions/cloudstack/flavor.rb +15 -0
- data/app/models/concerns/fog_extensions/cloudstack/server.rb +88 -0
- data/app/models/concerns/foreman_cpp_cloudstack/compute.rb +28 -0
- data/app/models/foreman_cpp_cloudstack/cloudstack.rb +238 -0
- data/app/views/api/v1/compute_resources/cloudstack.json.rabl +1 -0
- data/app/views/api/v2/compute_resources/cloudstack.json.rabl +1 -0
- data/app/views/compute_resources/form/_cloudstack.html.erb +15 -0
- data/app/views/compute_resources/show/_cloudstack.html.erb +4 -0
- data/app/views/compute_resources_vms/form/_cloudstack.html.erb +9 -0
- data/app/views/compute_resources_vms/index/_cloudstack.html.erb +20 -0
- data/app/views/compute_resources_vms/show/_cloudstack.html.erb +18 -0
- data/app/views/images/form/_cloudstack.html.erb +3 -0
- data/lib/foreman_cpp_cloudstack.rb +3 -0
- data/lib/foreman_cpp_cloudstack/engine.rb +40 -0
- data/lib/foreman_cpp_cloudstack/version.rb +3 -0
- data/lib/tasks/foreman_cpp_cloudstack_tasks.rake +4 -0
- data/locale/Makefile +6 -0
- data/test/buildhost.sh +29 -0
- data/test/buildhostds.sh +29 -0
- data/test/foreman_cpp_cloudstack_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +100 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= select_f f, :flavor_id, compute_resource.flavors, :id, :name, {}, :label => _('Service Offering') %>
|
2
|
+
<%= select_f f, :image_id, compute_resource.images, :uuid, :name, {}, :label => _('Image') %>
|
3
|
+
<%= select_f f, :disk_offering_id, compute_resource.disk_offerings, :id, :name, {}, :label => _('Disk Offering') %>
|
4
|
+
<% new = f.object && f.object.id.blank? %>
|
5
|
+
|
6
|
+
<div id='subnet_selection'>
|
7
|
+
<%# select_f f, :zone_id, compute_resource.zones, :id, :name, {}, :label => _('Zone') %>
|
8
|
+
<%= select_f f, :network_ids, compute_resource.networks, :id, :network_id, {}, :label => _('Subnet') %>
|
9
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<table class="table table-bordered" data-table='inline'>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th><%= _('Name') %></th>
|
5
|
+
<th><%= _('Type') %></th>
|
6
|
+
<th><%= _('State') %></th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<% @vms.each do |vm| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= link_to_if_authorized vm.name, hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.identity) %></td>
|
13
|
+
<td><%= vm.flavor_with_object %></td>
|
14
|
+
<td> <span <%= vm_power_class(vm.ready?) %>> <%= vm_state(vm) %></span> </td>
|
15
|
+
<td>
|
16
|
+
<%= action_buttons(*available_actions(vm)) %>
|
17
|
+
</td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% title @vm.name %>
|
2
|
+
<div class='col-md-12'>
|
3
|
+
<table class="table table-bordered table-striped">
|
4
|
+
<tr><th colspan="2">Properties</th></tr>
|
5
|
+
|
6
|
+
<%= prop :availability_zone %>
|
7
|
+
<% @vm.all_addresses.each do |address| %>
|
8
|
+
<tr>
|
9
|
+
<td><%= address["pool"] %> network</td>
|
10
|
+
<td><%= address["ip"] %> (floating), <%= address["fixed_ip"] %> (fixed ip) </td>
|
11
|
+
</tr>
|
12
|
+
<% end %>
|
13
|
+
<%= prop :state %>
|
14
|
+
<%= prop :created_at %>
|
15
|
+
<%= prop :flavor_with_object, "Flavor" %>
|
16
|
+
<%= prop :security_groups, "Security Groups" %>
|
17
|
+
</table>
|
18
|
+
</div>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<%= text_f f, :username, :value => @image.username || "root", :help_inline => _("The user that is used to ssh into the instance, normally cloud-user, ec2-user, ubuntu, root etc") %>
|
2
|
+
<%= image_field(f) %>
|
3
|
+
<%= checkbox_f f, :user_data, :help_inline => _("Does this image support user data input (e.g. via cloud-init)?") %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'fast_gettext'
|
2
|
+
require 'gettext_i18n_rails'
|
3
|
+
require 'fog'
|
4
|
+
require 'fog/cloudstack'
|
5
|
+
require 'fog/cloudstack/models/compute/server'
|
6
|
+
|
7
|
+
module ForemanCPPCloudstack
|
8
|
+
#Inherit from the Rails module of the parent app (Foreman), not the plugin.
|
9
|
+
#Thus, inherits from ::Rails::Engine and not from Rails::Engine
|
10
|
+
class Engine < ::Rails::Engine
|
11
|
+
engine_name 'foreman_cpp_cloudstack'
|
12
|
+
|
13
|
+
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
14
|
+
|
15
|
+
initializer 'foreman_cpp_cloudstack.register_gettext', :after => :load_config_initializers do |app|
|
16
|
+
locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
|
17
|
+
locale_domain = 'foreman_cpp_cloudstack'
|
18
|
+
|
19
|
+
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
20
|
+
end
|
21
|
+
|
22
|
+
initializer 'foreman_cpp_cloudstack.register_plugin', :after => :finisher_hook do |app|
|
23
|
+
Foreman::Plugin.register :foreman_cpp_cloudstack do
|
24
|
+
requires_foreman '>= 1.7'
|
25
|
+
compute_resource ForemanCPPCloudstack::Cloudstack
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
config.to_prepare do
|
31
|
+
begin
|
32
|
+
Fog::Compute::Cloudstack::Server.send(:include, ::FogExtensions::Cloudstack::Server)
|
33
|
+
Host::Managed.send(:include, ForemanCPPCloudstack::Compute)
|
34
|
+
rescue => e
|
35
|
+
puts "#{ForemanCPPCloudstack}: skipping engine hook (#{e.to_s})"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/locale/Makefile
ADDED
data/test/buildhost.sh
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
curl -s -H "Accept:application/json" -X POST \
|
3
|
+
-k -u admin:changeme \
|
4
|
+
-d "host[name]=test$(date +%s%N)" \
|
5
|
+
-d "host[hostgroup_id]=1" \
|
6
|
+
-d "host[environment_id]=1" \
|
7
|
+
-d "host[managed]=true" \
|
8
|
+
-d "host[type]=Host::Managed" \
|
9
|
+
-d "capabilities=image" \
|
10
|
+
-d "host[domain_id]=1" \
|
11
|
+
-d "host[compute_resource_id]=1" \
|
12
|
+
-d "host[compute_attributes][network_ids]=b952b73c-3df7-42b3-b763-c165d532055f" \
|
13
|
+
-d "host[interfaces_attributes][new_interfaces][_destroy]=false" \
|
14
|
+
-d "host[interfaces_attributes][new_interfaces][type]=Nic::Managed" \
|
15
|
+
-d "host[interfaces_attributes][new_interfaces][provider]=IPMI" \
|
16
|
+
-d "host[compute_attributes][flavor_id]=f13c5944-01a1-42a2-a667-01ec2d240959" \
|
17
|
+
-d "host[architecture_id]=1" \
|
18
|
+
-d "host[operatingsystem_id]=1" \
|
19
|
+
-d "provision_method=image" \
|
20
|
+
-d "host[compute_attributes][image_id]=ef867ba8-418b-11e4-9e73-080027700f81" \
|
21
|
+
-d "host[build]=1" \
|
22
|
+
-d "host[enabled]=1" \
|
23
|
+
-d "host[overwrite]=false" \
|
24
|
+
-d "host[comment]= {\"tags\":{\"lob\":\"${lob}\"}}" \
|
25
|
+
"http://localhost:3000/api/hosts"
|
26
|
+
|
27
|
+
#-d "host[progress_report_id]=f91dde83-dda7-43ae-8034-e589560d59ff" \
|
28
|
+
#-d "host[puppet_ca_proxy_id]=2"
|
29
|
+
#-d "host[puppet_proxy_id]=1" \
|
data/test/buildhostds.sh
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
curl -s -H "Accept:application/json" -X POST \
|
3
|
+
-k -u admin:changeme \
|
4
|
+
-d "host[name]=test$(date +%s%N)" \
|
5
|
+
-d "host[hostgroup_id]=1" \
|
6
|
+
-d "host[environment_id]=1" \
|
7
|
+
-d "host[managed]=true" \
|
8
|
+
-d "host[type]=Host::Managed" \
|
9
|
+
-d "capabilities=image" \
|
10
|
+
-d "host[domain_id]=1" \
|
11
|
+
-d "host[compute_resource_id]=1" \
|
12
|
+
-d "host[compute_attributes][subnet_id]=b952b73c-3df7-42b3-b763-c165d532055f" \
|
13
|
+
-d "host[interfaces_attributes][new_interfaces][_destroy]=false" \
|
14
|
+
-d "host[interfaces_attributes][new_interfaces][type]=Nic::Managed" \
|
15
|
+
-d "host[interfaces_attributes][new_interfaces][provider]=IPMI" \
|
16
|
+
-d "host[compute_attributes][flavor_id]=f13c5944-01a1-42a2-a667-01ec2d240959" \
|
17
|
+
-d "host[architecture_id]=1" \
|
18
|
+
-d "host[operatingsystem_id]=1" \
|
19
|
+
-d "provision_method=image" \
|
20
|
+
-d "host[compute_attributes][image_id]=ef867ba8-418b-11e4-9e73-080027700f81" \
|
21
|
+
-d "host[build]=1" \
|
22
|
+
-d "host[enabled]=1" \
|
23
|
+
-d "host[overwrite]=false" \
|
24
|
+
-d "host[comment]= {\"tags\":{\"lob\":\"${lob}\"}}" \
|
25
|
+
"http://localhost:3000/api/hosts"
|
26
|
+
|
27
|
+
#-d "host[progress_report_id]=f91dde83-dda7-43ae-8034-e589560d59ff" \
|
28
|
+
#-d "host[puppet_ca_proxy_id]=2"
|
29
|
+
#-d "host[puppet_proxy_id]=1" \
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
# Load fixtures from the engine
|
13
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_cpp_cloudstack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bytemine GmbH, Daniel Rauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Provision and manage a Cloudstack Server from Foreman.
|
42
|
+
email:
|
43
|
+
- info@bytemine.net
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/models/concerns/fog_extensions/cloudstack/flavor.rb
|
52
|
+
- app/models/concerns/fog_extensions/cloudstack/server.rb
|
53
|
+
- app/models/concerns/foreman_cpp_cloudstack/compute.rb
|
54
|
+
- app/models/foreman_cpp_cloudstack/cloudstack.rb
|
55
|
+
- app/views/api/v1/compute_resources/cloudstack.json.rabl
|
56
|
+
- app/views/api/v2/compute_resources/cloudstack.json.rabl
|
57
|
+
- app/views/compute_resources/form/_cloudstack.html.erb
|
58
|
+
- app/views/compute_resources/show/_cloudstack.html.erb
|
59
|
+
- app/views/compute_resources_vms/form/_cloudstack.html.erb
|
60
|
+
- app/views/compute_resources_vms/index/_cloudstack.html.erb
|
61
|
+
- app/views/compute_resources_vms/show/_cloudstack.html.erb
|
62
|
+
- app/views/images/form/_cloudstack.html.erb
|
63
|
+
- lib/foreman_cpp_cloudstack.rb
|
64
|
+
- lib/foreman_cpp_cloudstack/engine.rb
|
65
|
+
- lib/foreman_cpp_cloudstack/version.rb
|
66
|
+
- lib/tasks/foreman_cpp_cloudstack_tasks.rake
|
67
|
+
- locale/Makefile
|
68
|
+
- test/buildhost.sh
|
69
|
+
- test/buildhostds.sh
|
70
|
+
- test/foreman_cpp_cloudstack_test.rb
|
71
|
+
- test/test_helper.rb
|
72
|
+
homepage: http://github.com/bytemine/foreman-cloudstack
|
73
|
+
licenses:
|
74
|
+
- GPL-3
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.2.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Provision and manage a Cloudstack Server from Foreman
|
96
|
+
test_files:
|
97
|
+
- test/buildhost.sh
|
98
|
+
- test/buildhostds.sh
|
99
|
+
- test/test_helper.rb
|
100
|
+
- test/foreman_cpp_cloudstack_test.rb
|