vmfloaty 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/vmfloaty.rb +20 -27
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32aeb5f5ad140e3f722d44e74fd408d4543544b6
|
4
|
+
data.tar.gz: 5eb1d4eefe202458d0992f5b76a16950665da699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55dc19efe45545e1b3c9f30782af9392d7df29ffd1b329c7b604c6f46558cbdf444d9d42f699010ac404c1bd32588b0a3cad258f70b8e684d6a989a77526c20
|
7
|
+
data.tar.gz: 3ea84be6897b142f1ac7a6c045f3a322497848c3611867dafe438f9e6f4c35b3c9522361a526132929e9ede36665015b5aa4f2fda7d8c0d58c55e5b02cfd608e
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ gem install vmfloaty
|
|
45
45
|
If you do not wish to continuely specify various config options with the cli, you can have a dotfile in your home directory for some defaults. For example:
|
46
46
|
|
47
47
|
```yaml
|
48
|
-
#file at /Users/me/.
|
48
|
+
#file at /Users/me/.vmfloaty.yml
|
49
49
|
url: 'http://vmpooler.mycompany.net'
|
50
50
|
user: 'brian'
|
51
51
|
```
|
data/lib/vmfloaty.rb
CHANGED
@@ -10,28 +10,27 @@ class Vmfloaty
|
|
10
10
|
include Commander::Methods
|
11
11
|
|
12
12
|
def run
|
13
|
-
program :version, '0.2.
|
13
|
+
program :version, '0.2.3'
|
14
14
|
program :description, 'A CLI helper tool for Puppet Labs vmpooler to help you stay afloat'
|
15
15
|
|
16
16
|
config = read_config
|
17
17
|
|
18
18
|
command :get do |c|
|
19
|
-
c.syntax = 'floaty get [
|
19
|
+
c.syntax = 'floaty get [hostname,...]'
|
20
20
|
c.summary = 'Gets a vm or vms based on the os flag'
|
21
21
|
c.description = ''
|
22
|
-
c.example 'Gets 3 vms', 'floaty get --user brian --url http://vmpooler.example.com
|
22
|
+
c.example 'Gets 3 vms', 'floaty get centos,centos,debian --user brian --url http://vmpooler.example.com'
|
23
23
|
c.option '--verbose', 'Enables verbose output'
|
24
24
|
c.option '--user STRING', String, 'User to authenticate with'
|
25
25
|
c.option '--url STRING', String, 'URL of vmpooler'
|
26
26
|
c.option '--token STRING', String, 'Token for vmpooler'
|
27
|
-
c.option '--os STRING', String, 'Operating systems to retrieve'
|
28
27
|
c.option '--notoken', 'Makes a request without a token'
|
29
28
|
c.action do |args, options|
|
30
29
|
verbose = options.verbose || config['verbose']
|
31
30
|
token = options.token || config['token']
|
32
31
|
user = options.user ||= config['user']
|
33
32
|
url = options.url ||= config['url']
|
34
|
-
os_types =
|
33
|
+
os_types = args[0]
|
35
34
|
no_token = options.notoken
|
36
35
|
|
37
36
|
unless no_token.nil?
|
@@ -55,16 +54,15 @@ class Vmfloaty
|
|
55
54
|
end
|
56
55
|
|
57
56
|
command :list do |c|
|
58
|
-
c.syntax = 'floaty list [
|
57
|
+
c.syntax = 'floaty list [hostname]'
|
59
58
|
c.summary = 'Shows a list of available vms from the pooler'
|
60
59
|
c.description = ''
|
61
|
-
c.example 'Filter the list on centos', 'floaty list
|
60
|
+
c.example 'Filter the list on centos', 'floaty list centos --url http://vmpooler.example.com'
|
62
61
|
c.option '--verbose', 'Enables verbose output'
|
63
|
-
c.option '--filter STRING', String, 'A filter to apply to the list'
|
64
62
|
c.option '--url STRING', String, 'URL of vmpooler'
|
65
63
|
c.action do |args, options|
|
66
64
|
verbose = options.verbose || config['verbose']
|
67
|
-
filter =
|
65
|
+
filter = args[0]
|
68
66
|
url = options.url ||= config['url']
|
69
67
|
|
70
68
|
os_list = Pooler.list(verbose, url, filter)
|
@@ -76,14 +74,13 @@ class Vmfloaty
|
|
76
74
|
c.syntax = 'floaty query [options]'
|
77
75
|
c.summary = 'Get information about a given vm'
|
78
76
|
c.description = ''
|
79
|
-
c.example 'Get information about a sample host', 'floaty query --url http://vmpooler.example.com
|
77
|
+
c.example 'Get information about a sample host', 'floaty query hostname --url http://vmpooler.example.com'
|
80
78
|
c.option '--verbose', 'Enables verbose output'
|
81
79
|
c.option '--url STRING', String, 'URL of vmpooler'
|
82
|
-
c.option '--host STRING', String, 'Hostname to query'
|
83
80
|
c.action do |args, options|
|
84
81
|
verbose = options.verbose || config['verbose']
|
85
82
|
url = options.url ||= config['url']
|
86
|
-
hostname =
|
83
|
+
hostname = args[0]
|
87
84
|
|
88
85
|
query = Pooler.query(verbose, url, hostname)
|
89
86
|
puts query
|
@@ -91,22 +88,21 @@ class Vmfloaty
|
|
91
88
|
end
|
92
89
|
|
93
90
|
command :modify do |c|
|
94
|
-
c.syntax = 'floaty modify [
|
91
|
+
c.syntax = 'floaty modify [hostname]'
|
95
92
|
c.summary = 'Modify a vms tags and TTL'
|
96
93
|
c.description = ''
|
97
94
|
c.example 'description', 'command example'
|
98
95
|
c.option '--verbose', 'Enables verbose output'
|
99
96
|
c.option '--url STRING', String, 'URL of vmpooler'
|
100
97
|
c.option '--token STRING', String, 'Token for vmpooler'
|
101
|
-
c.option '--host STRING', String, 'Hostname to modify'
|
102
98
|
c.option '--lifetime INT', Integer, 'VM TTL (Integer, in hours)'
|
103
|
-
c.option '--tags
|
99
|
+
c.option '--tags STRING', String, 'free-form VM tagging (json)'
|
104
100
|
c.action do |args, options|
|
105
101
|
verbose = options.verbose || config['verbose']
|
106
102
|
url = options.url ||= config['url']
|
107
|
-
hostname =
|
103
|
+
hostname = args[0]
|
108
104
|
lifetime = options.lifetime
|
109
|
-
tags = options.tags
|
105
|
+
tags = JSON.parse(options.tags)
|
110
106
|
token = options.token || config['token']
|
111
107
|
|
112
108
|
res_body = Pooler.modify(verbose, url, hostname, token, lifetime, tags)
|
@@ -115,16 +111,15 @@ class Vmfloaty
|
|
115
111
|
end
|
116
112
|
|
117
113
|
command :delete do |c|
|
118
|
-
c.syntax = 'floaty delete [
|
114
|
+
c.syntax = 'floaty delete [hostname,...]'
|
119
115
|
c.summary = 'Schedules the deletion of a host or hosts'
|
120
116
|
c.description = ''
|
121
|
-
c.example 'Schedules the deletion of a host or hosts', 'floaty delete
|
117
|
+
c.example 'Schedules the deletion of a host or hosts', 'floaty delete myhost1,myhost2 --url http://vmpooler.example.com'
|
122
118
|
c.option '--verbose', 'Enables verbose output'
|
123
|
-
c.option '--hosts STRING', String, 'Hostname(s) to delete'
|
124
119
|
c.option '--url STRING', String, 'URL of vmpooler'
|
125
120
|
c.action do |args, options|
|
126
121
|
verbose = options.verbose || config['verbose']
|
127
|
-
hosts =
|
122
|
+
hosts = args[0]
|
128
123
|
url = options.url ||= config['url']
|
129
124
|
|
130
125
|
Pooler.delete(verbose, url, hosts)
|
@@ -135,15 +130,14 @@ class Vmfloaty
|
|
135
130
|
c.syntax = 'floaty snapshot [options]'
|
136
131
|
c.summary = 'Takes a snapshot of a given vm'
|
137
132
|
c.description = ''
|
138
|
-
c.example 'Takes a snapshot for a given host', 'floaty snapshot
|
133
|
+
c.example 'Takes a snapshot for a given host', 'floaty snapshot myvm.example.com --url http://vmpooler.example.com --token a9znth9dn01t416hrguu56ze37t790bl'
|
139
134
|
c.option '--verbose', 'Enables verbose output'
|
140
135
|
c.option '--url STRING', String, 'URL of vmpooler'
|
141
|
-
c.option '--host STRING', String, 'Hostname to modify'
|
142
136
|
c.option '--token STRING', String, 'Token for vmpooler'
|
143
137
|
c.action do |args, options|
|
144
138
|
verbose = options.verbose || config['verbose']
|
145
139
|
url = options.url ||= config['url']
|
146
|
-
hostname =
|
140
|
+
hostname = args[0]
|
147
141
|
token = options.token ||= config['token']
|
148
142
|
|
149
143
|
res_body = Pooler.snapshot(verbose, url, hostname, token)
|
@@ -155,16 +149,15 @@ class Vmfloaty
|
|
155
149
|
c.syntax = 'floaty revert [options]'
|
156
150
|
c.summary = 'Reverts a vm to a specified snapshot'
|
157
151
|
c.description = ''
|
158
|
-
c.example 'Reverts to a snapshot for a given host', 'floaty revert
|
152
|
+
c.example 'Reverts to a snapshot for a given host', 'floaty revert myvm.example.com --url http://vmpooler.example.com --token a9znth9dn01t416hrguu56ze37t790bl --snapshot n4eb4kdtp7rwv4x158366vd9jhac8btq'
|
159
153
|
c.option '--verbose', 'Enables verbose output'
|
160
154
|
c.option '--url STRING', String, 'URL of vmpooler'
|
161
|
-
c.option '--host STRING', String, 'Hostname to modify'
|
162
155
|
c.option '--token STRING', String, 'Token for vmpooler'
|
163
156
|
c.option '--snapshot STRING', String, 'SHA of snapshot'
|
164
157
|
c.action do |args, options|
|
165
158
|
verbose = options.verbose || config['verbose']
|
166
159
|
url = options.url ||= config['url']
|
167
|
-
hostname =
|
160
|
+
hostname = args[0]
|
168
161
|
token = options.token || config['token']
|
169
162
|
snapshot_sha = options.snapshot
|
170
163
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmfloaty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Cain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|