chef-metal-lxc 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef_metal_lxc/lxc_provisioner.rb +10 -10
- data/lib/chef_metal_lxc/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed7dfed2acc5f5c14b12786111cf062074f2165
|
4
|
+
data.tar.gz: c34889c04ef95bea3ae6b036a24a39bcd270b654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a93dab3facce1903bb30177604f07140881749e28f24668cc3e8f28de1c73f3a2b893b36ec7a3539a0de83c2286efa6247843bbdda0a29bad4476c72f2e4aa19
|
7
|
+
data.tar.gz: e717b1b724124d7e1d0c9e34cdb63b1b7bee0ebc7e9c2145395020134e23f6b1243215cd39346d0111d28600ca295849e16b4048fc708cc1d3b842ce7f40438a
|
@@ -26,7 +26,7 @@ module ChefMetalLXC
|
|
26
26
|
# different from the original node object).
|
27
27
|
#
|
28
28
|
# ## Parameters
|
29
|
-
#
|
29
|
+
# action_handler - the action_handler object that provides context.
|
30
30
|
# node - node object (deserialized json) representing this machine. If
|
31
31
|
# the node has a provisioner_options hash in it, these will be used
|
32
32
|
# instead of options provided by the provisioner. TODO compare and
|
@@ -48,7 +48,7 @@ module ChefMetalLXC
|
|
48
48
|
# -- provisioner_url: lxc:<lxc_path>
|
49
49
|
# -- name: container name
|
50
50
|
#
|
51
|
-
def acquire_machine(
|
51
|
+
def acquire_machine(action_handler, node)
|
52
52
|
# TODO verify that the existing provisioner_url in the node is the same as ours
|
53
53
|
|
54
54
|
# Set up the modified node data
|
@@ -61,7 +61,7 @@ module ChefMetalLXC
|
|
61
61
|
# Create the container if it does not exist
|
62
62
|
ct = LXC::Container.new(provisioner_output['name'], lxc_path)
|
63
63
|
unless ct.defined?
|
64
|
-
|
64
|
+
action_handler.perform_action "create lxc container #{provisioner_output['name']}" do
|
65
65
|
#
|
66
66
|
# Set config
|
67
67
|
#
|
@@ -84,14 +84,14 @@ module ChefMetalLXC
|
|
84
84
|
|
85
85
|
# Unfreeze the frozen
|
86
86
|
if ct.state == :frozen
|
87
|
-
|
87
|
+
action_handler.perform_action "unfreeze lxc container #{provisioner_output['name']} (state is #{ct.state})" do
|
88
88
|
ct.unfreeze
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
# Get stopped containers running
|
93
93
|
unless ct.running?
|
94
|
-
|
94
|
+
action_handler.perform_action "start lxc container #{provisioner_output['name']} (state is #{ct.state})" do
|
95
95
|
# Have to shell out to lxc-start for now, ct.start holds server sockets open!
|
96
96
|
lxc_start = "lxc-start -d -n #{Shellwords.escape(provisioner_output['name'])}"
|
97
97
|
# TODO add ability to change options on start
|
@@ -118,26 +118,26 @@ module ChefMetalLXC
|
|
118
118
|
machine_for(node)
|
119
119
|
end
|
120
120
|
|
121
|
-
def delete_machine(
|
121
|
+
def delete_machine(action_handler, node)
|
122
122
|
if node['normal'] && node['normal']['provisioner_output']
|
123
123
|
provisioner_output = node['normal']['provisioner_output']
|
124
124
|
ct = LXC::Container.new(provisioner_output['name'], lxc_path)
|
125
125
|
if ct.defined?
|
126
|
-
|
126
|
+
action_handler.perform_action "delete lxc container #{provisioner_output['name']}" do
|
127
127
|
ct.destroy
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
131
|
-
convergence_strategy_for(node).delete_chef_objects(
|
131
|
+
convergence_strategy_for(node).delete_chef_objects(action_handler, node)
|
132
132
|
end
|
133
133
|
|
134
|
-
def stop_machine(
|
134
|
+
def stop_machine(action_handler, node)
|
135
135
|
provisioner_options = node['normal']['provisioner_options']
|
136
136
|
if node['normal'] && node['normal']['provisioner_output']
|
137
137
|
provisioner_output = node['normal']['provisioner_output']
|
138
138
|
ct = LXC::Container.new(provisioner_output['name'], lxc_path)
|
139
139
|
if ct.running?
|
140
|
-
|
140
|
+
action_handler.perform_action "delete lxc container #{provisioner_output['name']}" do
|
141
141
|
ct.stop
|
142
142
|
end
|
143
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-metal-lxc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ranjib Dey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: chef-metal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby-lxc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|