marathon-scooter 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -1
- data/bin/scooter +1 -0
- data/lib/scooter/commands/info.rb +24 -17
- data/lib/scooter/gli.rb +26 -18
- data/lib/scooter/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a0f104c9e674cce6b58e72b896572830e8900b
|
4
|
+
data.tar.gz: 170ba99b351d7322f51c7d7943a9976e0c4abeb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e04f8c6dc0fc9748393119f874331a6335b8ab061a4a14b29f791adb32de41f15af0ded82c71025442976959c9fa94f7d21f502c79de311c5ce40bdc3e197ebc
|
7
|
+
data.tar.gz: 62ddf0235cd0b0e195b41e6795c2a37a4a27c4ff5611e10b808683940bb026d2728796bf4d54d6238242c68a8973ee39e19d76209ce7bcf098fd1dc48a5a71e7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.1.2 - 2015-09-11
|
2
|
+
|
3
|
+
* Added exception handling around `info` command.
|
4
|
+
* Added some additional exception handling around common network exceptions.
|
5
|
+
|
1
6
|
## 0.1.1 - 2015-09-03
|
2
7
|
|
3
8
|
* Fixed `clean` bug with JSON files that do not include a leading slash for the application id.
|
data/README.md
CHANGED
@@ -65,13 +65,21 @@ This command will clean up the JSON for a given file or directory of files, remo
|
|
65
65
|
Scooter provides the ability to set global options via environment variables for the following:
|
66
66
|
|
67
67
|
SCOOTER_COLOR
|
68
|
+
|
68
69
|
SCOOTER_MARATHON_HOST
|
70
|
+
|
69
71
|
SCOOTER_MARATHON_USER
|
72
|
+
|
70
73
|
SCOOTER_MARATHON_PASS
|
74
|
+
|
71
75
|
SCOOTER_MARATHON_PROXY_HOST
|
76
|
+
|
72
77
|
SCOOTER_MARATHON_PROXY_PORT
|
78
|
+
|
73
79
|
SCOOTER_MARATHON_PROXY_USER
|
80
|
+
|
74
81
|
SCOOTER_MARATHON_PROXY_PASS
|
82
|
+
|
75
83
|
SCOOTER_VERBOSE
|
76
84
|
|
77
85
|
## Examples
|
@@ -88,7 +96,13 @@ scooter info
|
|
88
96
|
|
89
97
|
By default Scooter looks for Marathon on localhost and provides an option to specify what Marathon host to target:
|
90
98
|
|
91
|
-
````
|
99
|
+
````bash
|
92
100
|
scooter --marathon=https://somecluster.marathon.service.consul info
|
93
101
|
````
|
94
102
|
|
103
|
+
Or using environment variables:
|
104
|
+
|
105
|
+
````bash
|
106
|
+
export SCOOTER_MARATHON_HOST=https://marathon.service.consul
|
107
|
+
scooter info
|
108
|
+
````
|
data/bin/scooter
CHANGED
@@ -6,24 +6,31 @@ module Scooter
|
|
6
6
|
class Info < Scooter::Command
|
7
7
|
def run
|
8
8
|
Scooter.ui.verbose("Executing the `#{name}` command.")
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Scooter.ui.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
9
|
+
begin
|
10
|
+
|
11
|
+
apps = ::Marathon::App.list
|
12
|
+
|
13
|
+
Scooter.ui.announce('---- Marathon Configuration ----')
|
14
|
+
Scooter.ui.out("Name: #{::Marathon.info['name']}")
|
15
|
+
Scooter.ui.out("Checkpoint: #{::Marathon.info['marathon_config']['checkpoint']}")
|
16
|
+
Scooter.ui.out("High Availability: #{::Marathon.info['marathon_config']['ha'].to_s.green}")
|
17
|
+
Scooter.ui.out("Version: #{::Marathon.info['version']}")
|
18
|
+
Scooter.ui.out
|
19
|
+
|
20
|
+
if apps.length > 0
|
21
|
+
Scooter.ui.announce('---- Application Configuration ----')
|
22
|
+
|
23
|
+
apps.each do |app|
|
24
|
+
# Derive the colors for the various output
|
25
|
+
read_only_color = app.read_only ? :red : :light_green
|
26
|
+
|
27
|
+
Scooter.ui.out("#{printf('%-25s', app.id)} I:#{app.instances} C:#{app.cpus} M:#{app.mem} D:#{app.disk} RO:#{Scooter.ui.color(app.read_only.to_s,read_only_color)}")
|
28
|
+
end
|
29
|
+
else
|
30
|
+
Scooter.ui.warn('There are no applications configured.')
|
24
31
|
end
|
25
|
-
|
26
|
-
Scooter.ui.warn(
|
32
|
+
rescue ::Marathon::Error => e
|
33
|
+
Scooter.ui.warn(e.inspect)
|
27
34
|
end
|
28
35
|
|
29
36
|
Scooter.ui.verbose("Execution of `#{name}` command has completed.")
|
data/lib/scooter/gli.rb
CHANGED
@@ -10,7 +10,7 @@ module Scooter
|
|
10
10
|
APP_ID_REGEX = /^[a-zA-z0-9\.\-\/]+$/
|
11
11
|
|
12
12
|
def initialize
|
13
|
-
program_desc 'Opinionated synchronization of Marathon
|
13
|
+
program_desc 'Opinionated synchronization of Marathon apps from JSON files.'
|
14
14
|
version Scooter::Version::STRING.dup
|
15
15
|
|
16
16
|
# Global Accepts
|
@@ -91,10 +91,18 @@ module Scooter
|
|
91
91
|
# Error handling
|
92
92
|
|
93
93
|
on_error do |e|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
case e
|
95
|
+
when ::Marathon::Error::AuthenticationError
|
96
|
+
$stderr.puts "Login failed. Please check credentials."
|
97
|
+
when ::Marathon::Error::ClientError
|
98
|
+
$stdout.puts "Missing required argument: #{e.message}"
|
99
|
+
when ::Marathon::Error::IOError
|
100
|
+
$stderr.puts "Unable to connect to host!"
|
101
|
+
when ::Timeout::Error
|
102
|
+
$stderr.puts "Timeout while connecting to host!"
|
103
|
+
else
|
104
|
+
$stderr.puts "Unhandled exception(#{e.class}) -- #{e.message}"
|
105
|
+
end
|
98
106
|
end
|
99
107
|
|
100
108
|
# Commands
|
@@ -116,13 +124,13 @@ module Scooter
|
|
116
124
|
end
|
117
125
|
end
|
118
126
|
|
119
|
-
desc 'Remove
|
127
|
+
desc 'Remove app configurations from Marathon that do not exist in the given directory.'
|
120
128
|
command :clean do |c|
|
121
129
|
|
122
|
-
c.desc '
|
130
|
+
c.desc 'An app configuration directory'
|
123
131
|
c.flag [:dir, :directory]
|
124
132
|
|
125
|
-
c.desc 'Perform the actual deletion of the
|
133
|
+
c.desc 'Perform the actual deletion of the app(s) in Marathon'
|
126
134
|
c.switch [:delete], default_value: false
|
127
135
|
|
128
136
|
c.action do |global_options, options, _args|
|
@@ -137,13 +145,13 @@ module Scooter
|
|
137
145
|
end
|
138
146
|
end
|
139
147
|
|
140
|
-
desc 'Delete the
|
148
|
+
desc 'Delete the configuration from Marathon for the given app.'
|
141
149
|
command :delete do |c|
|
142
150
|
|
143
151
|
c.desc 'Application ID'
|
144
152
|
c.flag [:id], required: true, must_match: APP_ID_REGEX
|
145
153
|
|
146
|
-
c.desc 'Perform the actual deletion of the
|
154
|
+
c.desc 'Perform the actual deletion of the app in Marathon'
|
147
155
|
c.switch [:delete], default_value: false
|
148
156
|
|
149
157
|
c.action do |global_options, options, _args|
|
@@ -151,10 +159,10 @@ module Scooter
|
|
151
159
|
end
|
152
160
|
end
|
153
161
|
|
154
|
-
desc 'Export the
|
162
|
+
desc 'Export the app configurations whose name match the given regex.'
|
155
163
|
command :export do |c|
|
156
164
|
|
157
|
-
c.desc '
|
165
|
+
c.desc 'An app configuration directory'
|
158
166
|
c.flag [:dir, :directory]
|
159
167
|
|
160
168
|
c.desc 'Marathon Application Regex. (Note: nil implies `.*`)'
|
@@ -193,13 +201,13 @@ module Scooter
|
|
193
201
|
end
|
194
202
|
end
|
195
203
|
|
196
|
-
desc 'Synchronize the given
|
204
|
+
desc 'Synchronize the given app configuration(s) with Marathon.'
|
197
205
|
command :sync do |c|
|
198
206
|
|
199
|
-
c.desc '
|
207
|
+
c.desc 'An app configuration directory'
|
200
208
|
c.flag [:dir, :directory]
|
201
209
|
|
202
|
-
c.desc '
|
210
|
+
c.desc 'An app configuration file'
|
203
211
|
c.flag [:file]
|
204
212
|
|
205
213
|
c.action do |global_options, options, _args|
|
@@ -226,13 +234,13 @@ module Scooter
|
|
226
234
|
end
|
227
235
|
end
|
228
236
|
|
229
|
-
desc 'Tidy the JSON format for the given
|
237
|
+
desc 'Tidy the JSON format for the given app configuration(s).'
|
230
238
|
command :tidy do |c|
|
231
239
|
|
232
|
-
c.desc '
|
240
|
+
c.desc 'An app configuration directory'
|
233
241
|
c.flag [:dir, :directory]
|
234
242
|
|
235
|
-
c.desc '
|
243
|
+
c.desc 'An app configuration file'
|
236
244
|
c.flag [:file]
|
237
245
|
|
238
246
|
c.action do |global_options, options, _args|
|
data/lib/scooter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marathon-scooter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yieldbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.8'
|
153
|
-
description: Opinionated synchronization of Marathon
|
153
|
+
description: Opinionated synchronization of Marathon apps from JSON files.
|
154
154
|
email:
|
155
155
|
- devops@yieldbot.com
|
156
156
|
executables:
|
@@ -203,7 +203,7 @@ rubyforge_project:
|
|
203
203
|
rubygems_version: 2.0.14
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
|
-
summary: Opinionated synchronization of Marathon
|
206
|
+
summary: Opinionated synchronization of Marathon apps from JSON files.
|
207
207
|
test_files:
|
208
208
|
- spec/scooter_spec.rb
|
209
209
|
- spec/spec_helper.rb
|