foreman_azure_rm 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/app/controllers/foreman_azure_rm/concerns/compute_resources_controller_extensions.rb +4 -4
- data/app/controllers/foreman_azure_rm/concerns/hosts_controller_extensions.rb +1 -1
- data/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb +1 -1
- data/app/models/foreman_azure_rm/azure_rm.rb +8 -8
- data/app/models/foreman_azure_rm/azure_rm_compute.rb +3 -3
- data/lib/foreman_azure_rm.rb +1 -1
- data/lib/foreman_azure_rm/azure_sdk_adapter.rb +2 -2
- data/lib/foreman_azure_rm/engine.rb +5 -5
- data/lib/foreman_azure_rm/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ded44e5ec295b20033b5c0903fecaa55637c19f4fdeaf95a37a03397073fd0
|
4
|
+
data.tar.gz: cb9f2190045dd7d32909e107c55663887561f9545b3327f3aca0930ae8b069e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982ed4a40ec28d77728dd7d0f201c8783d53b29854c39f46a9295a6883df3ed0e728e8cae8a2239597f8439d67ee7d316f8f61d81675752361fd3051f8b9f7fb
|
7
|
+
data.tar.gz: 9076e42d4cadbcc931f1ff2ccf61c8df068ad80534d6e9dfbe6f70de655b656de5fd68abd25f5e7c3c6cbbdb937fa93d5c930a23e45a6ab82a52a5784403006a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Foreman
|
1
|
+
# Foreman AzureRm Plugin
|
2
2
|
|
3
3
|
## Description
|
4
4
|
```foreman_azure_rm``` adds [Microsoft Azure Resource Manager](http://azure.com/) as a compute resource for The Foreman
|
@@ -23,9 +23,9 @@
|
|
23
23
|
## Configuration
|
24
24
|
Go to **Infrastructure > Compute Resources** and click on "New Compute Resource".
|
25
25
|
|
26
|
-
Choose the **
|
26
|
+
Choose the **Azure Resource Manager provider**, and fill in all the fields. You need a Subscription ID, Tenant ID, Client ID and a Client Secret which you can generate from your [Microsoft Azure subscription](https://docs.bmc.com/docs/cloudlifecyclemanagement/46/setting-up-a-tenant-id-client-id-and-client-secret-for-azure-resource-manager-provisioning-669202145.html#SettingupaTenantID,ClientID,andClientSecretforAzureResourceManagerprovisioning-SetupTenantIDPrereqPrerequisites)
|
27
27
|
|
28
|
-
That's it. You're now ready to create and manage Azure resources in your new
|
28
|
+
That's it. You're now ready to create and manage Azure resources in your new Azure Resource Manager compute resource. You should see something like this in the Compute Resource page:
|
29
29
|
|
30
30
|
|
31
31
|
![](https://i.imgur.com/9J7tPJa.png)
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module ForemanAzureRm
|
2
2
|
module Concerns
|
3
3
|
module ComputeResourcesControllerExtensions
|
4
4
|
include Api::Version2
|
@@ -7,9 +7,9 @@ module ForemanAzureRM
|
|
7
7
|
update_api(:create, :update) do
|
8
8
|
param :compute_resource, Hash do
|
9
9
|
# Not adding :tenant as already specified in core.
|
10
|
-
param :app_ident, String, :desc => N_("Client ID for
|
11
|
-
param :secret_key, String, :desc => N_("Client Secret for
|
12
|
-
param :sub_id, String, :desc => N_("Subscription ID for
|
10
|
+
param :app_ident, String, :desc => N_("Client ID for AzureRm")
|
11
|
+
param :secret_key, String, :desc => N_("Client Secret for AzureRm")
|
12
|
+
param :sub_id, String, :desc => N_("Subscription ID for AzureRm")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
require 'base64'
|
5
5
|
|
6
|
-
module
|
7
|
-
class
|
6
|
+
module ForemanAzureRm
|
7
|
+
class AzureRm < ComputeResource
|
8
8
|
|
9
9
|
include VMExtensions::ManagedVM
|
10
10
|
alias_attribute :sub_id, :user
|
@@ -40,7 +40,7 @@ module ForemanAzureRM
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def sdk
|
43
|
-
@sdk ||=
|
43
|
+
@sdk ||= ForemanAzureRm::AzureSdkAdapter.new(tenant, app_ident, secret_key, sub_id)
|
44
44
|
end
|
45
45
|
|
46
46
|
def to_label
|
@@ -88,7 +88,7 @@ module ForemanAzureRM
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def new_vm(args = {})
|
91
|
-
return
|
91
|
+
return AzureRmCompute.new(sdk: sdk) if args.empty? || args[:image_id].nil?
|
92
92
|
opts = vm_instance_defaults.merge(args.to_h).deep_symbolize_keys
|
93
93
|
# convert rails nested_attributes into a plain hash
|
94
94
|
nested_args = opts.delete(:interfaces_attributes)
|
@@ -113,7 +113,7 @@ module ForemanAzureRM
|
|
113
113
|
ifaces << new_interface(iface_attrs)
|
114
114
|
end
|
115
115
|
end
|
116
|
-
|
116
|
+
AzureRmCompute.new(azure_vm: raw_vm ,sdk: sdk, resource_group: opts[:resource_group], nics: ifaces)
|
117
117
|
end
|
118
118
|
|
119
119
|
def provided_attributes
|
@@ -180,7 +180,7 @@ module ForemanAzureRM
|
|
180
180
|
container = VMContainer.new
|
181
181
|
# Load all vms of the region
|
182
182
|
sdk.list_vms(region).each do |vm|
|
183
|
-
container.virtualmachines <<
|
183
|
+
container.virtualmachines << AzureRmCompute.new(azure_vm: vm, sdk:sdk, nics: vm_nics(vm))
|
184
184
|
end
|
185
185
|
container
|
186
186
|
end
|
@@ -243,9 +243,9 @@ module ForemanAzureRM
|
|
243
243
|
logger.debug "Virtual Machine #{args[:vm_name]} Created Successfully."
|
244
244
|
create_vm_extension(region, args)
|
245
245
|
# return the vm object using azure_vm
|
246
|
-
|
246
|
+
AzureRmCompute.new(azure_vm: vm, sdk: sdk, resource_group: args[:resource_group], nics: vm_nics(vm))
|
247
247
|
rescue RuntimeError => e
|
248
|
-
Foreman::Logging.exception('Unhandled
|
248
|
+
Foreman::Logging.exception('Unhandled AzureRm error', e)
|
249
249
|
destroy_vm vm.id if vm
|
250
250
|
raise e
|
251
251
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module ForemanAzureRm
|
2
|
+
class AzureRmCompute
|
3
3
|
attr_accessor :sdk
|
4
4
|
attr_accessor :azure_vm
|
5
5
|
attr_accessor :resource_group
|
@@ -123,7 +123,7 @@ module ForemanAzureRM
|
|
123
123
|
_("%{vm_size} VM Size") % {:vm_size => vm_size}
|
124
124
|
end
|
125
125
|
|
126
|
-
# Following properties are for
|
126
|
+
# Following properties are for AzureRm
|
127
127
|
# These are not part of Foreman's interface
|
128
128
|
|
129
129
|
def vm_size
|
data/lib/foreman_azure_rm.rb
CHANGED
@@ -4,7 +4,7 @@ require 'azure_mgmt_network'
|
|
4
4
|
require 'azure_mgmt_storage'
|
5
5
|
require 'azure_mgmt_compute'
|
6
6
|
|
7
|
-
module
|
7
|
+
module ForemanAzureRm
|
8
8
|
Storage = Azure::Storage::Profiles::Latest::Mgmt
|
9
9
|
Network = Azure::Network::Profiles::Latest::Mgmt
|
10
10
|
Compute = Azure::Compute::Profiles::Latest::Mgmt
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module ForemanAzureRm
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
engine_name 'foreman_azure_rm'
|
4
4
|
|
@@ -9,14 +9,14 @@ module ForemanAzureRM
|
|
9
9
|
initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do
|
10
10
|
Foreman::Plugin.register :foreman_azure_rm do
|
11
11
|
requires_foreman '>= 1.17'
|
12
|
-
compute_resource
|
12
|
+
compute_resource ForemanAzureRm::AzureRm
|
13
13
|
parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id, :region
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
initializer "foreman_azure_rm.add_rabl_view_path" do
|
18
18
|
Rabl.configure do |config|
|
19
|
-
config.view_paths <<
|
19
|
+
config.view_paths << ForemanAzureRm::Engine.root.join('app', 'views')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -35,9 +35,9 @@ module ForemanAzureRM
|
|
35
35
|
# Use excon as default so that HTTP Proxy settings of foreman works
|
36
36
|
Faraday::default_adapter=:excon
|
37
37
|
|
38
|
-
::HostsController.send(:include,
|
38
|
+
::HostsController.send(:include, ForemanAzureRm::Concerns::HostsControllerExtensions)
|
39
39
|
|
40
|
-
Api::V2::ComputeResourcesController.send(:include,
|
40
|
+
Api::V2::ComputeResourcesController.send(:include, ForemanAzureRm::Concerns::ComputeResourcesControllerExtensions)
|
41
41
|
end
|
42
42
|
|
43
43
|
rake_tasks do
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = '2.0.
|
1
|
+
module ForemanAzureRm
|
2
|
+
VERSION = '2.0.4'.freeze
|
3
3
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_azure_rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditi Puntambekar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-12-
|
13
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deface
|