fleet-api 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9884b83b1cc12a5a754d0026501f14d07f2a7eaf
4
- data.tar.gz: e434bfd9213128f9c1e72e3af63251e98a116ab3
3
+ metadata.gz: fc67d53034f0f63cc50eb450214eb215f3a8066a
4
+ data.tar.gz: fa261735dc741aee77142943541075964e1b08d5
5
5
  SHA512:
6
- metadata.gz: 8910d52994d4e7cad4aa417db58a1f435c0d21e9a8fa6103794f5aec29de86ddec78711d0aa78462692eda6e9a4d8d0db741e8c97800f1b812789b66c447ffd5
7
- data.tar.gz: 53ac7bd82a4bf902d5c1bcc7ccf973bc317d1c594d1bd51066093875ef08908182eb2164e308292870664a3aef7fbf9e0c6bbf2de27ef49ae72165be9d33e0cd
6
+ metadata.gz: 7830f480923b8f7a1c6c854afe89483f02d7fd611e66c1a9d757aa26e37696c50726512720388e1b9887caa54298d0ff1360543d99cc4867c0209b6eaff60a23
7
+ data.tar.gz: 781530a7570c4389ecf4fe8966a33933d89d1f3fcb7300b0f98c3c5af4a8d64a8676a80e219665efd73e919ddc36cdaa906d7a8a20f765845599dcbed298b7bf
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ 0.6.0 - 2014-09-05
5
+ ------------------
6
+
7
+ ### Added
8
+ - Compatibility for Fleet 0.6.x (not backward compatible with older versions of Fleet)
9
+
4
10
  0.5.3 - 2014-08-26
5
11
  ------------------
6
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fleet-api (0.5.3)
4
+ fleet-api (0.6.0)
5
5
  faraday (= 0.8.9)
6
6
  faraday_middleware (= 0.9.0)
7
7
 
data/README.md CHANGED
@@ -14,7 +14,7 @@ As work on the actual Fleet API progresses, this library will be refactored to u
14
14
 
15
15
  An alternative implementation is available in the [cloudspace/ruby-fleetctl](https://github.com/cloudspace/ruby-fleetctl) gem. The *ruby-fleetctl* gem takes a different approach and uses SSH to interact directly with the *fleetctl* binary to send commands. Our approach of writing directly to etcd cuts out the *fleetctl* middleman but is in more danger of being broken by future releases since we're effectively using a "private API".
16
16
 
17
- The current version of the *fleet-api* gem is known to work with version 0.5.0 of Fleet which ships with the the current stable version of CoreOS (367.1.0)
17
+ The current version of the *fleet-api* gem is known to work with version 0.6.0 of Fleet.
18
18
 
19
19
  ### Installation
20
20
 
data/lib/fleet/client.rb CHANGED
@@ -12,8 +12,8 @@ module Fleet
12
12
  class Client
13
13
 
14
14
  FLEET_PATH = 'v2/keys/_coreos.com/fleet'
15
- MAX_RETRIES = 10
16
- SLEEP_TIME = (4.0 / MAX_RETRIES.to_f)
15
+ MAX_RETRIES = 20
16
+ SLEEP_TIME = (10.0 / MAX_RETRIES.to_f)
17
17
 
18
18
  attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
19
19
 
@@ -65,7 +65,7 @@ module Fleet
65
65
 
66
66
  def unload(service_name)
67
67
  update_job_target_state(service_name, :inactive)
68
- wait_for_load_state(service_name, 'not-found')
68
+ wait_for_load_state(service_name, :no_state)
69
69
  end
70
70
 
71
71
  def destroy(service_name)
@@ -11,10 +11,7 @@ module Fleet
11
11
  end
12
12
 
13
13
  def to_unit
14
- {
15
- 'Contents' => unit_body,
16
- 'Raw' => raw
17
- }
14
+ { 'Raw' => raw }
18
15
  end
19
16
 
20
17
  def to_job
@@ -30,14 +27,6 @@ module Fleet
30
27
 
31
28
  private
32
29
 
33
- def unit_body
34
- @service_def.each_with_object({}) do |(heading, section), memo|
35
- memo[heading] = section.each_with_object({}) do |(key, value), memo|
36
- memo[key] = [value]
37
- end
38
- end
39
- end
40
-
41
30
  def raw
42
31
  raw_string = ''
43
32
 
data/lib/fleet/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fleet
2
- VERSION = '0.5.3'.freeze unless defined?(Fleet::VERSION)
2
+ VERSION = '0.6.0'.freeze unless defined?(Fleet::VERSION)
3
3
  end
@@ -190,13 +190,9 @@ describe Fleet::Client do
190
190
  describe '#unload' do
191
191
  let(:service_name) { 'foo.service' }
192
192
 
193
- let(:fleet_state) do
194
- { 'node' => { 'value' => '{ "load_state": "not-found" }' } }
195
- end
196
-
197
193
  before do
198
194
  allow(subject).to receive(:update_job_target_state)
199
- allow(subject).to receive(:get_state).and_return(fleet_state)
195
+ allow(subject).to receive(:get_state).and_raise(Fleet::NotFound, 'boom')
200
196
  end
201
197
 
202
198
  it 'invokes #update_job_target_state' do
@@ -213,13 +209,17 @@ describe Fleet::Client do
213
209
 
214
210
  context 'when the unload state cannot be achieved' do
215
211
 
212
+ let(:fleet_state) do
213
+ { 'node' => { 'value' => '{ "load_state": "loaded" }' } }
214
+ end
215
+
216
216
  before do
217
- allow(subject).to receive(:get_state).and_raise(Fleet::NotFound, 'boom')
217
+ allow(subject).to receive(:get_state).and_return(fleet_state)
218
218
  allow(subject).to receive(:sleep)
219
219
  end
220
220
 
221
- it 're-checks the state 10 times' do
222
- expect(subject).to receive(:get_state).exactly(10).times
221
+ it 're-checks the state 20 times' do
222
+ expect(subject).to receive(:get_state).exactly(20).times
223
223
  subject.unload(service_name) rescue nil
224
224
  end
225
225
 
@@ -44,17 +44,7 @@ Description=#{service_hash['Unit']['Description']}
44
44
  ExecStart=#{service_hash['Service']['ExecStart']}
45
45
  UNIT_FILE
46
46
 
47
- expected = {
48
- 'Contents' => {
49
- 'Unit' => {
50
- 'Description' => [service_hash['Unit']['Description']]
51
- },
52
- 'Service' => {
53
- 'ExecStart' => [service_hash['Service']['ExecStart']]
54
- }
55
- },
56
- 'Raw' => raw
57
- }
47
+ expected = { 'Raw' => raw }
58
48
 
59
49
  expect(subject.to_unit).to eq expected
60
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fleet-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday