kitchen-gogetkitchen 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/lib/kitchen/driver/gogetkitchen.rb +30 -5
- data/lib/kitchen/driver/gogetkitchen_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bb712cab9e165c8d9a9c4477350b7aec73e05d1
|
4
|
+
data.tar.gz: 790dea760d847718ddc07ac5cf581a3c845caca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60643336e4c87552832abea846756e100ecfb7ea41d371e40dc2cd740b1dee7186877d8421e5cf32404615a3e5095c8248e3d9981fd9bf3afefc16d1b00a50bf
|
7
|
+
data.tar.gz: c38e598cc4a3407e7c79907f0e94963511bce6ab02df42a3e3d0b54e442ef00bc20b3c7cdd9829a3e653c85463ab4fbf0ae8ffaa07e9f4dfa8d484f0779fed30
|
data/.gitignore
CHANGED
@@ -28,7 +28,7 @@ module Kitchen
|
|
28
28
|
# Gogetkitchen driver for Kitchen.
|
29
29
|
#
|
30
30
|
# @author Don Draper <donoldfashioned@gmail.com>
|
31
|
-
class
|
31
|
+
class Gogetkitchen < Kitchen::Driver::Base
|
32
32
|
kitchen_driver_api_version 2
|
33
33
|
plugin_version Kitchen::Driver::GOGETKITCHEN_VERSION
|
34
34
|
|
@@ -36,15 +36,40 @@ module Kitchen
|
|
36
36
|
default_config :provider
|
37
37
|
default_config :template
|
38
38
|
|
39
|
-
binding.pry
|
40
|
-
|
41
39
|
def create(state)
|
42
|
-
|
40
|
+
provider = choose_provider(config[:provider])
|
41
|
+
provider.create(instance.name)
|
42
|
+
domain = Gogetit.maas.get_domain
|
43
|
+
state[:hostname] = instance.name + '.' + domain
|
44
|
+
state[:username] = config[:username]
|
45
|
+
wait_until_available(instance.name)
|
43
46
|
|
47
|
+
info 'Waiting for SSH..'
|
48
|
+
conn = instance.transport.connection(state)
|
49
|
+
conn.wait_until_ready
|
50
|
+
conn.close
|
44
51
|
end
|
45
52
|
|
46
53
|
def destroy(state)
|
47
|
-
|
54
|
+
provider = choose_provider(config[:provider])
|
55
|
+
provider.destroy(instance.name)
|
56
|
+
|
57
|
+
instance.transport.connection(state).close
|
58
|
+
end
|
59
|
+
|
60
|
+
def choose_provider(provider)
|
61
|
+
case provider
|
62
|
+
when 'lxd'
|
63
|
+
Gogetit.lxd
|
64
|
+
when 'libvirt'
|
65
|
+
Gogetit.libvirt
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def wait_until_available(hostname)
|
70
|
+
until Gogetit.maas.domain_name_exists?(hostname)
|
71
|
+
sleep 3
|
72
|
+
end
|
48
73
|
end
|
49
74
|
end
|
50
75
|
end
|