foreman_xen 0.1.8 → 0.2.0
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/Rakefile +1 -1
- data/app/controllers/foreman_xen/snapshots_controller.rb +74 -78
- data/app/helpers/xen_compute_helper.rb +45 -42
- data/app/models/concerns/fog_extensions/xenserver/server.rb +6 -7
- data/app/models/concerns/foreman_xen/host_helper_extensions.rb +40 -17
- data/app/models/foreman_xen/xenserver.rb +113 -153
- data/app/overrides/hosts/show/snapshot_override.html.erb.deface +2 -0
- data/app/overrides/hosts/show/snapshot_override_legacy.html.erb.deface +2 -0
- data/app/views/compute_resources/form/_xenserver.html.erb +2 -2
- data/app/views/compute_resources_vms/form/_hypervisors.html.erb +4 -4
- data/app/views/compute_resources_vms/form/_templates.html.erb +2 -2
- data/app/views/compute_resources_vms/form/_volume.html.erb +1 -1
- data/app/views/compute_resources_vms/form/_xenstore.html.erb +1 -7
- data/app/views/compute_resources_vms/form/xenserver/_base.html.erb +96 -95
- data/app/views/compute_resources_vms/index/_xenserver.html.erb +7 -7
- data/app/views/foreman_xen/snapshots/new.html.erb +14 -14
- data/app/views/foreman_xen/snapshots/show.html.erb +4 -4
- data/config/routes.rb +2 -0
- data/lib/foreman_xen/engine.rb +11 -3
- data/lib/foreman_xen/version.rb +1 -1
- data/lib/foreman_xen/vnc_tunnel.rb +30 -28
- data/test/foreman_xen_test.rb +1 -1
- data/test/test_helper.rb +4 -4
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df01d8a9f3e43bd910e4597a70b24e38f6dd7d9
|
4
|
+
data.tar.gz: b6707ccb696495513f969f8168e27f7dd8a3456a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9bf52e332b9413d0b2502b4d41c921ebaa20af439f5257afcbcadbdb8bc40433d61b76db6ef31279d8fc0ce3aea7fc4aad46ff5f1e0d3b3ffa9931e036d9c0
|
7
|
+
data.tar.gz: 2138939601ccad3c2950061173ee665e416c89c651f0a47ad1b07d8b18a0e74d958b5ea9893f4084df2658a8a908ef2f298e71a2113049783a09d52a6a87d4bb
|
data/Rakefile
CHANGED
@@ -1,164 +1,155 @@
|
|
1
1
|
module ForemanXen
|
2
2
|
class SnapshotsController < ::ApplicationController
|
3
3
|
helper :all
|
4
|
-
skip_before_filter
|
4
|
+
skip_before_filter :verify_authenticity_token
|
5
5
|
|
6
|
-
#
|
6
|
+
#GET - foreman_xen/snapshots/:host_id
|
7
7
|
def show
|
8
|
-
id
|
9
|
-
|
8
|
+
id = params[:id]
|
9
|
+
if id != nil && id != ""
|
10
|
+
@host = get_host_by_id(id)
|
11
|
+
end
|
12
|
+
puts @host.inspect
|
10
13
|
if !@host.nil? && @host.compute_resource_id
|
11
14
|
@compute_resource = get_compute_resource_for_host(@host)
|
12
|
-
|
15
|
+
if !@compute_resource.nil?
|
13
16
|
vm = @compute_resource.find_vm_by_uuid(@host.uuid)
|
14
17
|
if !vm.nil?
|
15
|
-
@snapshots =
|
18
|
+
@snapshots = @compute_resource.get_snapshots_for_vm(vm)
|
16
19
|
else
|
17
|
-
process_error(:error_msg => "Error retrieving compute resource #{@host.compute_resource_id} from provider.")
|
20
|
+
process_error({:error_msg => "Error retrieving compute resource #{@host.compute_resource_id} from provider."})
|
18
21
|
return
|
19
22
|
end
|
20
23
|
end
|
21
24
|
elsif @host.nil?
|
22
|
-
process_error(:error_msg => "No host found with ID: #{id}.")
|
25
|
+
process_error({:error_msg => "No host found with ID: #{id}."})
|
23
26
|
return
|
24
27
|
else
|
25
|
-
process_error(:error_msg => "No compute resource found for host with ID: #{id}.")
|
28
|
+
process_error({:error_msg => "No compute resource found for host with ID: #{id}."})
|
26
29
|
return
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
30
|
-
#
|
33
|
+
#GET = foreman_xen/snapshots/revert
|
31
34
|
def revert
|
32
|
-
id
|
33
|
-
ref
|
34
|
-
@host
|
35
|
+
id = params[:id]
|
36
|
+
ref = params[:ref]
|
37
|
+
@host = get_host_by_id(id)
|
35
38
|
@compute_resource = get_compute_resource_by_host_id(id)
|
36
39
|
if @compute_resource
|
37
40
|
if @host
|
38
41
|
vm = @compute_resource.find_vm_by_uuid(@host.uuid)
|
39
42
|
vm.revert(ref)
|
40
43
|
vm.start
|
41
|
-
process_success(
|
42
|
-
:success_msg => "Succesfully reverted and powered on #{@host.name}",
|
43
|
-
:success_redirect => "/foreman_xen/snapshots/#{id}"
|
44
|
-
)
|
44
|
+
process_success({:success_msg => "Succesfully reverted and powered on #{@host.name}", :success_redirect => "/foreman_xen/snapshots/#{id}"})
|
45
45
|
return
|
46
46
|
else
|
47
|
-
process_error(:error_msg =>
|
47
|
+
process_error({:error_msg => "Error retrieving host information for #{@host.name}" })
|
48
48
|
return
|
49
49
|
end
|
50
50
|
else
|
51
|
-
process_error(:error_msg =>
|
51
|
+
process_error({:error_msg => "Error retrieving compute resource information for #{@host.name}" })
|
52
52
|
return
|
53
53
|
end
|
54
|
-
process_success(
|
55
|
-
|
56
|
-
:success_redirect => "/foreman_xen/snapshots/#{id}"
|
57
|
-
)
|
58
|
-
nil
|
54
|
+
process_success({:success_msg => ("Succesfully reverted #{@host.name}"), :success_redirect => "/foreman_xen/snapshots/#{id}"})
|
55
|
+
return
|
59
56
|
end
|
60
57
|
|
61
|
-
#
|
58
|
+
#GET = foreman_xen/snapshots/delete
|
62
59
|
def destroy
|
63
|
-
ref
|
64
|
-
id
|
65
|
-
@host
|
60
|
+
ref = params[:ref]
|
61
|
+
id = params[:id]
|
62
|
+
@host = get_host_by_id(id)
|
66
63
|
@compute_resource = get_compute_resource_by_host_id(id)
|
67
|
-
name
|
64
|
+
name = nil
|
68
65
|
if @compute_resource
|
69
66
|
if @host
|
70
|
-
snapshots =
|
71
|
-
snapshots.each do |snapshot|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
67
|
+
snapshots = @compute_resource.get_snapshots
|
68
|
+
snapshots.each do | snapshot |
|
69
|
+
if snapshot.reference == ref
|
70
|
+
name = snapshot.name
|
71
|
+
snapshot.destroy
|
72
|
+
notice ("Succesfully deleted snapshot #{snapshot.name}")
|
73
|
+
break
|
74
|
+
end
|
77
75
|
end
|
78
76
|
else
|
79
|
-
process_error(:error_msg =>
|
77
|
+
process_error({:error_msg => ("Error retrieving host information for host id: #{id}")})
|
80
78
|
return
|
81
79
|
end
|
82
80
|
else
|
83
|
-
process_error(:error_msg =>
|
81
|
+
process_error({:error_msg => ("Error retrieving compute resource information for host id: #{id}")})
|
84
82
|
return
|
85
83
|
end
|
86
|
-
process_success(
|
87
|
-
|
88
|
-
:success_redirect => "/foreman_xen/snapshots/#{id}"
|
89
|
-
)
|
90
|
-
nil
|
84
|
+
process_success({:success_msg => ("Succesfully deleted snapshot: #{name}"), :success_redirect => "/foreman_xen/snapshots/#{id}"})
|
85
|
+
return
|
91
86
|
end
|
92
87
|
|
93
|
-
#
|
88
|
+
#GET = foreman_xen/snapshots/:id/new
|
94
89
|
def new
|
95
|
-
id
|
90
|
+
id = params[:id]
|
96
91
|
@host = get_host_by_id(id)
|
97
92
|
if !@host.nil?
|
98
93
|
@compute_resource = get_compute_resource_by_host_id(id)
|
99
94
|
if @compute_resource.nil?
|
100
|
-
process_error(
|
101
|
-
:error_msg => "Error retrieving compute information for compute resource id: #{@host.compute_resource_id}"
|
102
|
-
)
|
95
|
+
process_error({:error_msg => "Error retrieving compute information for compute resource id: #{@host.compute_resource_id}"})
|
103
96
|
return
|
104
97
|
end
|
105
98
|
else
|
106
|
-
process_error(:error_msg => "Error retrieving host information for host id: #{id}")
|
99
|
+
process_error({:error_msg => "Error retrieving host information for host id: #{id}"})
|
100
|
+
return
|
107
101
|
end
|
108
102
|
end
|
109
103
|
|
110
|
-
#
|
104
|
+
#POST = foreman_xen/snapshots/:id/create
|
111
105
|
def create
|
112
|
-
id
|
106
|
+
id = params[:id]
|
113
107
|
name = params[:name]
|
114
|
-
if name.nil? || name ==
|
115
|
-
process_error(:error_msg =>
|
108
|
+
if name.nil? || name == ""
|
109
|
+
process_error({:error_msg => "You must supply a name."})
|
116
110
|
return
|
117
111
|
end
|
118
112
|
@host = get_host_by_id(id)
|
119
113
|
if !@host.nil?
|
120
114
|
@compute_resource = get_compute_resource_by_host_id(id)
|
121
115
|
else
|
122
|
-
process_error(:error_msg => "Error retrieving host information for host id #{id}")
|
116
|
+
process_error({:error_msg => "Error retrieving host information for host id #{id}"})
|
123
117
|
return
|
124
118
|
end
|
125
119
|
if !@compute_resource.nil?
|
126
120
|
vm = @compute_resource.find_vm_by_uuid(@host.uuid)
|
127
121
|
if !vm.nil?
|
128
122
|
vm.snapshot(name)
|
129
|
-
process_success(
|
130
|
-
:success_msg => "Succesfully created snapshot #{name} for #{@host.name}",
|
131
|
-
:success_redirect => "/foreman_xen/snapshots/#{id}"
|
132
|
-
)
|
123
|
+
process_success({:success_msg => "Succesfully created snapshot #{name} for #{@host.name}", :success_redirect => "/foreman_xen/snapshots/#{id}"})
|
133
124
|
return
|
134
125
|
else
|
135
|
-
process_error(:error_msg => "Error retrieving compute resource information for #{@host.name}")
|
126
|
+
process_error({:error_msg => "Error retrieving compute resource information for #{@host.name}"})
|
136
127
|
return
|
137
128
|
end
|
138
129
|
else
|
139
|
-
process_error(:error_msg => "Error retrieving compute provider information for #{@host.name}")
|
130
|
+
process_error({:error_msg => "Error retrieving compute provider information for #{@host.name}"})
|
140
131
|
return
|
141
132
|
end
|
142
133
|
end
|
143
134
|
|
144
135
|
def snapshots_url
|
145
136
|
case params[:action]
|
146
|
-
|
147
|
-
return '/'
|
148
|
-
when 'new'
|
149
|
-
id = params[:id]
|
150
|
-
if id.nil?
|
137
|
+
when 'show'
|
151
138
|
return '/'
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
139
|
+
when 'new'
|
140
|
+
id = params[:id]
|
141
|
+
if id.nil?
|
142
|
+
return '/'
|
143
|
+
else
|
144
|
+
return "/foreman_xen/snapshots/#{id}"
|
145
|
+
end
|
146
|
+
when 'create'
|
147
|
+
id = params[:id]
|
148
|
+
if id.nil?
|
149
|
+
return '/'
|
150
|
+
else
|
151
|
+
return "/foreman_xen/snapshots/#{id}/new"
|
152
|
+
end
|
162
153
|
end
|
163
154
|
end
|
164
155
|
|
@@ -170,11 +161,16 @@ module ForemanXen
|
|
170
161
|
|
171
162
|
def get_compute_resource_by_host_id(host_id)
|
172
163
|
host = get_host_by_id(host_id)
|
173
|
-
|
164
|
+
if host
|
165
|
+
ComputeResource.where(:id => host.compute_resource_id).to_a[0]
|
166
|
+
end
|
174
167
|
end
|
175
168
|
|
176
169
|
def get_compute_resource_for_host(host)
|
177
|
-
|
170
|
+
if host
|
171
|
+
ComputeResource.where(:id => host.compute_resource_id).to_a[0]
|
172
|
+
end
|
178
173
|
end
|
174
|
+
|
179
175
|
end
|
180
|
-
end
|
176
|
+
end
|
@@ -8,18 +8,17 @@ module XenComputeHelper
|
|
8
8
|
attribute_map
|
9
9
|
end
|
10
10
|
|
11
|
-
def init_vmdata
|
12
|
-
vmdata = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
:environment => ''
|
11
|
+
def init_vmdata()
|
12
|
+
vmdata = { :ifs =>
|
13
|
+
{ '0' => {
|
14
|
+
:ip => '',
|
15
|
+
:gateway => '',
|
16
|
+
:netmask => ''
|
17
|
+
}
|
18
|
+
},
|
19
|
+
:nameserver1 => '',
|
20
|
+
:nameserver2 => '',
|
21
|
+
:environment => ''
|
23
22
|
}
|
24
23
|
end
|
25
24
|
|
@@ -30,31 +29,35 @@ module XenComputeHelper
|
|
30
29
|
if new_host?(new)
|
31
30
|
compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
|
32
31
|
if compute_attributes['VBDs']
|
33
|
-
attribute_map[:volume_size]
|
32
|
+
attribute_map[:volume_size] = compute_attributes['VBDs']['physical_size'] ? compute_attributes['VBDs']['physical_size'] : nil
|
34
33
|
attribute_map[:volume_selected] = compute_attributes['VBDs']['sr_uuid'] ? compute_attributes['VBDs']['sr_uuid'] : nil
|
35
34
|
end
|
36
35
|
if compute_attributes['VIFs']
|
37
36
|
attribute_map[:network_selected] = compute_attributes['VIFs']['print'] ? compute_attributes['VIFs']['print'] : nil
|
38
37
|
end
|
39
|
-
attribute_map[:template_selected_custom]
|
38
|
+
attribute_map[:template_selected_custom] = compute_attributes['custom_template_name'] ? compute_attributes['custom_template_name'] : nil
|
40
39
|
attribute_map[:template_selected_builtin] = compute_attributes['builtin_template_name'] ? compute_attributes['custom_template_name'] : nil
|
41
|
-
attribute_map[:cpu_count]
|
42
|
-
attribute_map[:memory_min]
|
43
|
-
attribute_map[:memory_max]
|
44
|
-
attribute_map[:power_on]
|
40
|
+
attribute_map[:cpu_count] = compute_attributes['vcpus_max'] ? compute_attributes['vcpus_max'] : nil
|
41
|
+
attribute_map[:memory_min] = compute_attributes['memory_min'] ? compute_attributes['memory_min'] : nil
|
42
|
+
attribute_map[:memory_max] = compute_attributes['memory_max'] ? compute_attributes['memory_max'] : nil
|
43
|
+
attribute_map[:power_on] = compute_attributes['start'] ? compute_attributes['start'] : nil
|
44
|
+
elsif params && params['host'] && params['host']['compute_attributes']
|
45
|
+
if params['host']['compute_attributes']['VBDs']
|
46
|
+
attribute_map[:volume_size] = (params['host']['compute_attributes']['VBDs']['physical_size']) ? params['host']['compute_attributes']['VBDs']['physical_size'] : nil
|
47
|
+
attribute_map[:volume_selected] = (params['host']['compute_attributes']['VBDs']['sr_uuid']) ? params['host']['compute_attributes']['VBDs']['sr_uuid'] : nil
|
48
|
+
end
|
49
|
+
if params['host']['compute_attributes']['VIFs']
|
50
|
+
attribute_map[:network_selected] = params['host']['compute_attributes']['VIFs']['print'] ? params['host']['compute_attributes']['VIFs']['print'] : nil
|
51
|
+
end
|
52
|
+
attribute_map[:template_selected_custom] = params['host']['compute_attributes']['custom_template_name'] ? params['host']['compute_attributes']['custom_template_name'] : nil
|
53
|
+
attribute_map[:template_selected_builtin] = params['host']['compute_attributes']['builtin_template_name'] ? params['host']['compute_attributes']['builtin_template_name'] : nil
|
45
54
|
elsif new
|
46
|
-
attribute_map[:cpu_count] = new.vcpus_max ? new.vcpus_max : nil
|
47
|
-
attribute_map[:memory_min] = new.memory_static_min ? new.memory_static_min : nil
|
48
|
-
attribute_map[:memory_max] = new.memory_static_max ? new.memory_static_max : nil
|
49
55
|
if new.__vbds
|
50
|
-
|
51
|
-
|
52
|
-
attribute_map[:volume_selected] = vdi.sr.uuid ? vdi.sr.uuid : nil
|
53
|
-
attribute_map[:volume_size] = vdi.virtual_size ? (vdi.virtual_size.to_i / 1_073_741_824).to_s : nil
|
54
|
-
end
|
56
|
+
attribute_map[:volume_selected] = new.__vbds['sr_uuid'] ? new.__vbds['sr_uuid'] : nil
|
57
|
+
attribute_map[:volume_size] = new.__vbds['physical_size'] ? new.__vbds['physical_size'] : nil
|
55
58
|
end
|
56
59
|
if new.__vifs
|
57
|
-
attribute_map[:network_selected] = new.
|
60
|
+
attribute_map[:network_selected] = new.__vifs['print'] ? new.__vifs['print'] : nil
|
58
61
|
end
|
59
62
|
end
|
60
63
|
attribute_map
|
@@ -69,31 +72,31 @@ module XenComputeHelper
|
|
69
72
|
end
|
70
73
|
if compute_attributes
|
71
74
|
if compute_attributes['VBDs']
|
72
|
-
attribute_map[:volume_size]
|
75
|
+
attribute_map[:volume_size] = compute_attributes['VBDs']['physical_size'] ? compute_attributes['VBDs']['physical_size'] : nil
|
73
76
|
attribute_map[:volume_selected] = compute_attributes['VBDs']['sr_uuid'] ? compute_attributes['VBDs']['sr_uuid'] : nil
|
74
77
|
end
|
75
78
|
if compute_attributes['VIFs']
|
76
79
|
attribute_map[:network_selected] = compute_attributes['VIFs']['print'] ? compute_attributes['VIFs']['print'] : nil
|
77
80
|
end
|
78
|
-
attribute_map[:template_selected_custom]
|
81
|
+
attribute_map[:template_selected_custom] = compute_attributes['custom_template_name'] ? compute_attributes['custom_template_name'] : nil
|
79
82
|
attribute_map[:template_selected_builtin] = compute_attributes['builtin_template_name'] ? compute_attributes['builtin_template_name'] : nil
|
80
|
-
attribute_map[:cpu_count]
|
81
|
-
attribute_map[:memory_min]
|
82
|
-
attribute_map[:memory_max]
|
83
|
-
attribute_map[:power_on]
|
83
|
+
attribute_map[:cpu_count] = compute_attributes['vcpus_max'] ? compute_attributes['vcpus_max'] : nil
|
84
|
+
attribute_map[:memory_min] = compute_attributes['memory_min'] ? compute_attributes['memory_min'] : nil
|
85
|
+
attribute_map[:memory_max] = compute_attributes['memory_max'] ? compute_attributes['memory_max'] : nil
|
86
|
+
attribute_map[:power_on] = compute_attributes['start'] ? compute_attributes['start'] : nil
|
84
87
|
end
|
85
88
|
attribute_map
|
86
89
|
end
|
87
90
|
|
88
91
|
def empty_attribute_map
|
89
|
-
{
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
{:volume_size => nil,
|
93
|
+
:volume_selected => nil,
|
94
|
+
:network_selected => nil,
|
95
|
+
:template_selected_custom => nil,
|
96
|
+
:template_selected_builtin => nil,
|
97
|
+
:cpu_count => nil,
|
98
|
+
:memory_min => nil,
|
99
|
+
:memory_max => nil,
|
100
|
+
:power_on => nil}
|
98
101
|
end
|
99
102
|
end
|
@@ -6,17 +6,15 @@ module FogExtensions
|
|
6
6
|
include ActionView::Helpers::NumberHelper
|
7
7
|
|
8
8
|
attr_accessor :start
|
9
|
-
|
9
|
+
attr_accessor :memory_min, :memory_max, :custom_template_name, :builtin_template_name, :hypervisor_host
|
10
10
|
|
11
11
|
def to_s
|
12
12
|
name
|
13
13
|
end
|
14
14
|
|
15
|
-
def nics_attributes=(attrs)
|
16
|
-
end
|
15
|
+
def nics_attributes=(attrs); end
|
17
16
|
|
18
|
-
def volumes_attributes=(attrs)
|
19
|
-
end
|
17
|
+
def volumes_attributes=(attrs); end
|
20
18
|
|
21
19
|
def memory
|
22
20
|
memory_static_max.to_i
|
@@ -39,7 +37,7 @@ module FogExtensions
|
|
39
37
|
end
|
40
38
|
|
41
39
|
def vm_description
|
42
|
-
_(
|
40
|
+
_("%{cpus} CPUs and %{memory} memory") % {:cpus => vcpus_max, :memory => number_to_human_size(memory_max.to_i)}
|
43
41
|
end
|
44
42
|
|
45
43
|
def interfaces
|
@@ -47,8 +45,9 @@ module FogExtensions
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def select_nic(fog_nics, nic)
|
50
|
-
fog_nics[0]
|
48
|
+
return fog_nics[0]
|
51
49
|
end
|
50
|
+
|
52
51
|
end
|
53
52
|
end
|
54
53
|
end
|
@@ -2,26 +2,49 @@ module ForemanXen
|
|
2
2
|
module HostHelperExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
def xen_host_title_actions(host)
|
6
|
+
title_actions(
|
7
|
+
button_group(
|
8
|
+
link_to_if_authorized(_("Edit"), hash_for_edit_host_path(:id => host).merge(:auth_object => host),
|
9
|
+
:title => _("Edit your host"), :id => "edit-button"),
|
10
|
+
if not host.compute_resource.nil? and host.compute_resource.type =="ForemanXen::Xenserver"
|
11
|
+
link_to(_("Snapshots"), "../foreman_xen/snapshots/#{@host.id}/",
|
12
|
+
:title => _("Manage machine snapshots"))
|
13
|
+
end,
|
14
|
+
if host.build
|
15
|
+
link_to_if_authorized(_("Cancel build"), hash_for_cancelBuild_host_path(:id => host).merge(:auth_object => host, :permission => 'build_hosts'),
|
16
|
+
:disabled => host.can_be_built?,
|
17
|
+
:title => _("Cancel build request for this host"), :id => "cancel-build-button")
|
18
|
+
else
|
19
|
+
link_to_if_authorized(_("Build"), hash_for_host_path(:id => host).merge(:auth_object => host, :permission => 'build_hosts', :anchor => "review_before_build"),
|
20
|
+
:disabled => !host.can_be_built?,
|
21
|
+
:title => _("Enable rebuild on next host boot"),
|
22
|
+
:class => "btn",
|
23
|
+
:id => "build-review",
|
24
|
+
:data => { :toggle => 'modal',
|
25
|
+
:target => '#review_before_build',
|
26
|
+
:url => review_before_build_host_path(:id => host)
|
27
|
+
}
|
28
|
+
)
|
29
|
+
end
|
30
|
+
),
|
31
|
+
if host.compute_resource_id || host.bmc_available?
|
13
32
|
button_group(
|
14
|
-
|
15
|
-
_('Xen Snapshots'),
|
16
|
-
"../foreman_xen/snapshots/#{@host.id}/",
|
17
|
-
:title => _('Manage machine snapshots'),
|
18
|
-
:id => :xen_snap_button
|
19
|
-
)
|
33
|
+
link_to(_("Loading power state ..."), '#', :disabled => true, :id => :loading_power_state)
|
20
34
|
)
|
35
|
+
end,
|
36
|
+
button_group(
|
37
|
+
if host.try(:puppet_proxy)
|
38
|
+
link_to_if_authorized(_("Run puppet"), hash_for_puppetrun_host_path(:id => host).merge(:auth_object => host, :permission => 'puppetrun_hosts'),
|
39
|
+
:disabled => !Setting[:puppetrun],
|
40
|
+
:title => _("Trigger a puppetrun on a node; requires that puppet run is enabled"))
|
41
|
+
end
|
42
|
+
),
|
43
|
+
button_group(
|
44
|
+
link_to_if_authorized(_("Delete"), hash_for_host_path(:id => host).merge(:auth_object => host, :permission => 'destroy_hosts'),
|
45
|
+
:class => "btn btn-danger", :id => "delete-button", :data => { :message => _("Are you sure?") }, :method => :delete)
|
21
46
|
)
|
22
|
-
|
23
|
-
end
|
24
|
-
host_title_actions_without_xen_snap_button(*args)
|
47
|
+
)
|
25
48
|
end
|
26
49
|
end
|
27
50
|
end
|