foreman_azure 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_azure/host_os_azure_selected.js +3 -3
- data/app/controllers/foreman_azure/concerns/hosts_controller_extensions.rb +1 -1
- data/app/helpers/azure_images_helper.rb +1 -1
- data/app/models/concerns/fog_extensions/azure/server.rb +2 -0
- data/app/models/concerns/fog_extensions/azure/servers.rb +16 -3
- data/app/models/foreman_azure/azure.rb +7 -1
- data/app/models/foreman_azure/concerns/ssh_provision_extensions.rb +27 -0
- data/app/views/compute_resources_vms/show/_azure.html.erb +20 -0
- data/lib/foreman_azure/engine.rb +2 -0
- data/lib/foreman_azure/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ea76c38a3b8a43fb02dc75f6151da9c33a9e44a
|
4
|
+
data.tar.gz: d36db15142dd1e3f71ec94731c83fbc157a47dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50deb54b6d1dc4358d8f355555b53f31201d4402e0ec21e770ed66a20b1272c5cffb628b3f227a28d283f28b09e835255d0b8dc27f52f900927645f05a55591a
|
7
|
+
data.tar.gz: 9c1f72740bbe9a7aca370a97d393cc05d6e61e658b9422fd778809032e907c038f248996d67623bc6ef9322c569404a45ee3281391e92536459d7cf6f0378e13
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function azure_image_selected() {
|
2
|
-
var url = $('#
|
3
|
-
var imageId = $('#
|
2
|
+
var url = $('#host_compute_attributes_image_id').attr('data-url');
|
3
|
+
var imageId = $('#host_compute_attributes_image_id').val();
|
4
4
|
var azure_locations = $('#azure_locations');
|
5
5
|
var locations_spinner = $('#azure_locations_spinner');
|
6
6
|
tfm.tools.showSpinner();
|
@@ -10,7 +10,7 @@ function azure_image_selected() {
|
|
10
10
|
type:'get',
|
11
11
|
url: url,
|
12
12
|
complete: function(){
|
13
|
-
reloadOnAjaxComplete('#
|
13
|
+
reloadOnAjaxComplete('#host_compute_attributes_image_id');
|
14
14
|
locations_spinner.addClass('hide');
|
15
15
|
tfm.tools.hideSpinner();
|
16
16
|
},
|
@@ -2,7 +2,7 @@ module ForemanAzure
|
|
2
2
|
module Concerns
|
3
3
|
module HostsControllerExtensions
|
4
4
|
def locations
|
5
|
-
if (azure_resource = Image.find_by_uuid(params[:image_id])).present?
|
5
|
+
if (azure_resource = Image.unscoped.find_by_uuid(params[:image_id])).present?
|
6
6
|
render :json => azure_resource.compute_resource.
|
7
7
|
image_locations(params[:image_id])
|
8
8
|
else
|
@@ -3,16 +3,29 @@ module FogExtensions
|
|
3
3
|
module Servers
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
# Azure servers.all doesn't take any argument, against the fog
|
7
|
-
# standard, so we override the method.
|
8
|
-
# https://github.com/fog/fog-azure/pull/25
|
9
6
|
included do
|
10
7
|
alias_method_chain :all, :patched_arguments
|
8
|
+
alias_method_chain :get, :cloud_service_patch
|
11
9
|
end
|
12
10
|
|
11
|
+
# Azure servers.all doesn't take any argument, against the fog
|
12
|
+
# standard, so we override the method.
|
13
|
+
# https://github.com/fog/fog-azure/pull/25
|
13
14
|
def all_with_patched_arguments(_options = {})
|
14
15
|
all_without_patched_arguments
|
15
16
|
end
|
17
|
+
|
18
|
+
# Azure servers.get takes 2 arguments, the cloud service name and
|
19
|
+
# the vm_name. This is against the fog standard, however it's not
|
20
|
+
# possible to uniquely find a VM with just one argument. Instead,
|
21
|
+
# we try our best (see models/foreman_azure/azure.rb#find_vm_by_uuid
|
22
|
+
# for a similar method) to find it.
|
23
|
+
def get_with_cloud_service_patch(identity, cloud_service_name = nil)
|
24
|
+
cloud_service_name ||= identity
|
25
|
+
cloud_service_vm = get_without_cloud_service_patch(identity, cloud_service_name)
|
26
|
+
return cloud_service_vm if cloud_service_vm.present?
|
27
|
+
find { |vm| vm.vm_name == identity }
|
28
|
+
end
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
@@ -32,15 +32,21 @@ module ForemanAzure
|
|
32
32
|
client.images
|
33
33
|
end
|
34
34
|
|
35
|
+
def provided_attributes
|
36
|
+
super.merge(:ip => :public_ip_address)
|
37
|
+
end
|
38
|
+
|
35
39
|
def image_locations(image_id)
|
36
40
|
client.images.get(image_id).locations.split(';')
|
37
41
|
end
|
38
42
|
|
39
43
|
def create_vm(args = {})
|
44
|
+
args.delete_if { |_key, value| value.blank? }
|
40
45
|
args[:hostname] = args[:name]
|
41
46
|
args[:vm_name] = args[:name].split('.').first
|
42
47
|
args[:cloud_service_name] ||= args[:vm_name]
|
43
|
-
args[:
|
48
|
+
args[:image] = args[:image_id]
|
49
|
+
args[:vm_user] = Image.unscoped.find_by_uuid(args[:image_id]).username
|
44
50
|
args[:private_key_file] = url
|
45
51
|
super(args)
|
46
52
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ForemanAzure
|
2
|
+
module Concerns
|
3
|
+
module SSHProvisionExtensions
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
alias_method_chain :setSSHWaitForResponse, :use_ssh_keys
|
8
|
+
end
|
9
|
+
|
10
|
+
def setSSHWaitForResponse_with_use_ssh_keys
|
11
|
+
if compute_resource.type == "ForemanAzure::Azure"
|
12
|
+
self.client = Foreman::Provision::SSH.new(
|
13
|
+
provision_ip,
|
14
|
+
image.username,
|
15
|
+
{ :template => template_file.path,
|
16
|
+
:uuid => uuid,
|
17
|
+
:keys => [compute_resource.certificate_path] })
|
18
|
+
else
|
19
|
+
setSSHWaitForResponse_without_use_ssh_keys
|
20
|
+
end
|
21
|
+
rescue => e
|
22
|
+
failure _("Failed to login via SSH to %{name}: %{e}") %
|
23
|
+
{ :name => name, :e => e }, e
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% title @vm.name %>
|
2
|
+
<div class='col-md-12'>
|
3
|
+
<table class="<%= table_css_classes %>">
|
4
|
+
<thead>
|
5
|
+
<tr><th colspan="2"><%=_('Properties') %></th></tr>
|
6
|
+
</thead>
|
7
|
+
<tbody>
|
8
|
+
<%= prop :vm_name %>
|
9
|
+
<%= prop :ipaddress %>
|
10
|
+
<%= prop :deployment_status, _('Deployment status') %>
|
11
|
+
<%= prop :status %>
|
12
|
+
<%= prop :cloud_service_name, _('Cloud service name') %>
|
13
|
+
<%= prop :disk_name, _('Disk name') %>
|
14
|
+
<%= prop :image %>
|
15
|
+
<%= prop :vm_user %>
|
16
|
+
<%= prop :vm_size %>
|
17
|
+
<%= prop :storage_account_name, _('Storage account name') %>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
20
|
+
</div>
|
data/lib/foreman_azure/engine.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_azure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-azure
|
@@ -70,11 +70,13 @@ files:
|
|
70
70
|
- app/models/concerns/fog_extensions/azure/server.rb
|
71
71
|
- app/models/concerns/fog_extensions/azure/servers.rb
|
72
72
|
- app/models/foreman_azure/azure.rb
|
73
|
+
- app/models/foreman_azure/concerns/ssh_provision_extensions.rb
|
73
74
|
- app/overrides/add_image_location_js.rb
|
74
75
|
- app/views/compute_resources/form/_azure.html.erb
|
75
76
|
- app/views/compute_resources/show/_azure.html.erb
|
76
77
|
- app/views/compute_resources_vms/form/azure/_base.html.erb
|
77
78
|
- app/views/compute_resources_vms/index/_azure.html.erb
|
79
|
+
- app/views/compute_resources_vms/show/_azure.html.erb
|
78
80
|
- app/views/images/form/_azure.html.erb
|
79
81
|
- config/routes.rb
|
80
82
|
- lib/foreman_azure.rb
|