marathon-api 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/README.md +1 -1
- data/lib/marathon/app.rb +2 -3
- data/lib/marathon/container_volume.rb +0 -3
- data/lib/marathon/health_check.rb +5 -4
- data/lib/marathon/version.rb +1 -1
- data/marathon-api.gemspec +0 -1
- data/spec/marathon/app_spec.rb +6 -4
- data/spec/marathon/container_volume_spec.rb +0 -2
- data/spec/spec_helper.rb +0 -4
- metadata +3 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb0e48998c8f3c64b8002009bdba92f13aea4e8
|
4
|
+
data.tar.gz: 19ba1b91937a2455bc175da83552c5ce0f2455f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f41e51ef482f0a041b13efac4b7d47549419dc29ad8f021bc6e6f426da993d3d29ceaddc73263beeb3c7d312156bbba3a55266d61ce57b93eb0b4fcd7495c6be
|
7
|
+
data.tar.gz: 2c3497dae1b201f45df830c74fc781824b31ff7514b2de7a870942c4d4f6f15d5b898e2b1fee8cb627bad3805f132df6cfa6577ff7ad00820b7a94f4c1c68315
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
marathon-api
|
2
2
|
============
|
3
3
|
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/marathon-api.svg)](http://badge.fury.io/rb/marathon-api) [![travis-ci](https://travis-ci.org/otto-de/marathon-api.png?branch=master)](https://travis-ci.org/otto-de/marathon-api) [![Code Climate](https://codeclimate.com/github/otto-de/marathon-api/badges/gpa.svg)](https://codeclimate.com/github/otto-de/marathon-api)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/marathon-api.svg)](http://badge.fury.io/rb/marathon-api) [![travis-ci](https://travis-ci.org/otto-de/marathon-api.png?branch=master)](https://travis-ci.org/otto-de/marathon-api) [![Code Climate](https://codeclimate.com/github/otto-de/marathon-api/badges/gpa.svg)](https://codeclimate.com/github/otto-de/marathon-api)
|
5
5
|
|
6
6
|
This gem provides an object oriented interface to the [Marathon Remote API][1]. At the time if this writing, marathon-api is meant to interface with Marathon version 0.10.1.
|
7
7
|
|
data/lib/marathon/app.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# See https://mesosphere.github.io/marathon/docs/rest-api.html#apps for full list of API's methods.
|
3
3
|
class Marathon::App < Marathon::Base
|
4
4
|
|
5
|
-
ACCESSORS = %w[ id args cmd cpus disk env executor instances mem ports requirePorts
|
5
|
+
ACCESSORS = %w[ id args cmd cpus disk env executor fetch instances mem ports requirePorts
|
6
6
|
storeUris tasksHealthy tasksUnhealthy tasksRunning tasksStaged upgradeStrategy
|
7
7
|
deployments uris user version labels ]
|
8
8
|
|
@@ -10,7 +10,6 @@ class Marathon::App < Marathon::Base
|
|
10
10
|
:env => {},
|
11
11
|
:labels => {},
|
12
12
|
:ports => [],
|
13
|
-
:uris => [],
|
14
13
|
}
|
15
14
|
|
16
15
|
attr_reader :healthChecks, :constraints, :container, :read_only, :tasks
|
@@ -151,7 +150,7 @@ class Marathon::App < Marathon::Base
|
|
151
150
|
end
|
152
151
|
|
153
152
|
def pretty_uris
|
154
|
-
uris.map { |e| "URI: #{e}" }.join("\n")
|
153
|
+
[ (fetch || []).map { |e| e[:uri] } , uris ].compact.reduce([], :|).map { |e| "URI: #{e}" }.join("\n")
|
155
154
|
end
|
156
155
|
|
157
156
|
def pretty_constraints
|
@@ -13,9 +13,6 @@ class Marathon::ContainerVolume < Marathon::Base
|
|
13
13
|
super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS)
|
14
14
|
Marathon::Util.validate_choice('mode', mode, %w[RW RO])
|
15
15
|
raise Marathon::Error::ArgumentError, 'containerPath must not be nil' unless containerPath
|
16
|
-
raise Marathon::Error::ArgumentError, 'containerPath must be an absolute path' \
|
17
|
-
unless Pathname.new(containerPath).absolute?
|
18
|
-
raise Marathon::Error::ArgumentError, 'hostPath must not be nil' unless hostPath
|
19
16
|
end
|
20
17
|
|
21
18
|
def to_pretty_s
|
@@ -13,20 +13,21 @@ class Marathon::HealthCheck < Marathon::Base
|
|
13
13
|
}
|
14
14
|
|
15
15
|
ACCESSORS = %w[ command gracePeriodSeconds intervalSeconds maxConsecutiveFailures
|
16
|
-
path portIndex protocol timeoutSeconds ]
|
16
|
+
path portIndex protocol timeoutSeconds ignoreHttp1xx ]
|
17
17
|
|
18
18
|
# Create a new health check object.
|
19
19
|
# ++hash++: Hash returned by API.
|
20
20
|
def initialize(hash)
|
21
21
|
super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS)
|
22
|
-
Marathon::Util.validate_choice(:protocol, protocol, %w[HTTP TCP COMMAND])
|
22
|
+
Marathon::Util.validate_choice(:protocol, protocol, %w[HTTP TCP COMMAND HTTPS MESOS_HTTP MESOS_HTTPS MESOS_TCP])
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_s
|
26
26
|
if protocol == 'COMMAND'
|
27
27
|
"Marathon::HealthCheck { :protocol => #{protocol} :command => #{command} }"
|
28
|
-
elsif
|
29
|
-
"Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} :path => #{path}
|
28
|
+
elsif %w[HTTP HTTPS MESOS_HTTP MESOS_HTTPS].include? protocol
|
29
|
+
"Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} :path => #{path}" +
|
30
|
+
(%w[HTTP HTTPS].include? protocol and !ignoreHttp1xx.nil? ? " :ignoreHttp1xx => #{ignoreHttp1xx}" : '') + " }"
|
30
31
|
else
|
31
32
|
"Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} }"
|
32
33
|
end
|
data/lib/marathon/version.rb
CHANGED
data/marathon-api.gemspec
CHANGED
data/spec/marathon/app_spec.rb
CHANGED
@@ -12,7 +12,9 @@ describe Marathon::App do
|
|
12
12
|
},
|
13
13
|
'env' => {'FOO' => 'BAR', 'blubb' => 'blah'},
|
14
14
|
'constraints' => [['hostname', 'UNIQUE']],
|
15
|
-
'
|
15
|
+
'fetch' => [
|
16
|
+
{ 'uri' => 'http://example.com/big.tar' },
|
17
|
+
],
|
16
18
|
'labels' => {'abc' => '123'},
|
17
19
|
'version' => 'foo-version'
|
18
20
|
}, double(Marathon::MarathonInstance)) }
|
@@ -43,7 +45,7 @@ describe Marathon::App do
|
|
43
45
|
subject { described_class.new({'id' => '/app/foo'}, double(Marathon::MarathonInstance)) }
|
44
46
|
|
45
47
|
let(:expected_string) do
|
46
|
-
'{"env":{},"labels":{},"ports":[],"
|
48
|
+
'{"env":{},"labels":{},"ports":[],"id":"/app/foo"}'
|
47
49
|
end
|
48
50
|
|
49
51
|
its(:to_json) { should == expected_string }
|
@@ -153,7 +155,7 @@ describe Marathon::App do
|
|
153
155
|
expect(@subject).to receive(:check_read_only)
|
154
156
|
expect(@apps).to receive(:change).with(
|
155
157
|
'/app/foo',
|
156
|
-
{:env => {}, :labels => {}, :ports => [], :
|
158
|
+
{:env => {}, :labels => {}, :ports => [], :id => "/app/foo"},
|
157
159
|
false
|
158
160
|
)
|
159
161
|
@subject.start!
|
@@ -163,7 +165,7 @@ describe Marathon::App do
|
|
163
165
|
expect(@apps).to receive(:change)
|
164
166
|
.with(
|
165
167
|
'/app/foo',
|
166
|
-
{:env => {}, :labels => {}, :ports => [], :
|
168
|
+
{:env => {}, :labels => {}, :ports => [], :id => "/app/foo"},
|
167
169
|
false
|
168
170
|
)
|
169
171
|
@subject.start!
|
@@ -19,8 +19,6 @@ describe Marathon::ContainerVolume do
|
|
19
19
|
it 'should fail with invalid path' do
|
20
20
|
expect { subject.new(:hostPath => '/') }
|
21
21
|
.to raise_error(Marathon::Error::ArgumentError, /containerPath .* not be nil/)
|
22
|
-
expect { subject.new(:containerPath => '/') }
|
23
|
-
.to raise_error(Marathon::Error::ArgumentError, /hostPath .* not be nil/)
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
data/spec/spec_helper.rb
CHANGED
@@ -6,16 +6,12 @@ require 'simplecov'
|
|
6
6
|
require 'vcr'
|
7
7
|
require 'webmock'
|
8
8
|
require 'marathon'
|
9
|
-
require 'codeclimate-test-reporter'
|
10
9
|
|
11
10
|
%w[MARATHON_URL MARATHON_USER MARATHON_PASSWORD].each do |key|
|
12
11
|
ENV.delete(key)
|
13
12
|
end
|
14
13
|
|
15
|
-
CodeClimate::TestReporter.start
|
16
|
-
|
17
14
|
VCR.configure do |c|
|
18
|
-
c.ignore_hosts 'codeclimate.com'
|
19
15
|
c.allow_http_connections_when_no_cassette = false
|
20
16
|
c.cassette_library_dir = "fixtures/vcr"
|
21
17
|
c.hook_into :webmock
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marathon-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Bechstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -164,20 +164,6 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: codeclimate-test-reporter
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
167
|
description: A simple REST client for the Marathon Remote API
|
182
168
|
email:
|
183
169
|
- felix.bechstein@otto.de
|
@@ -305,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
291
|
version: '0'
|
306
292
|
requirements: []
|
307
293
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.4.
|
294
|
+
rubygems_version: 2.4.8
|
309
295
|
signing_key:
|
310
296
|
specification_version: 4
|
311
297
|
summary: A simple REST client for the Marathon Remote API
|
@@ -332,4 +318,3 @@ test_files:
|
|
332
318
|
- spec/marathon/task_spec.rb
|
333
319
|
- spec/marathon/util_spec.rb
|
334
320
|
- spec/spec_helper.rb
|
335
|
-
has_rdoc:
|