fleet-api 0.6.1 → 0.8.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: a3632dd50614806a6d05b70c954da24146cebf83
4
- data.tar.gz: 94458c2c48317cab5e2e7e18c8ea1ea0aae1c9c6
3
+ metadata.gz: 5c53fd4743be330713996996781ccfc244868131
4
+ data.tar.gz: 3e3fcb5fc7aa92b37944954975ea663dd2c7cb96
5
5
  SHA512:
6
- metadata.gz: c55fa3e17aa13c9167d048196d373295ad39dfeb334567299b9f1b9e4a54a92c02dc4d9d695ded62aee0f173d1bd312925eb76fba5cf66197dc615f6f9be0e54
7
- data.tar.gz: e82ec57fd09b71077a5b48e8f74d8daf053f4519ec263da0f3b729f728a1e445c60459eb07ea92188080ed7877276ffa061eabff9391edfd83eb01addaa38b49
6
+ metadata.gz: 9e10c7a3c3db3aa443dd971f636fe0b99185a06a2535908243b514eae402d8b39e9087724b1c7304bfb28ce3b865eadd8ac9dde1b90ef854c2394ea5105ac13d
7
+ data.tar.gz: 661108e5c653840a37e6c9921b516c327eeeda9f1cb0fe67301099d025b0d7178988e688fc574edb926f1db2a425eb84aa9000ce28e9bcbcf53a62ed93e6b315
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ 0.8.0 - 2014-11-07
5
+ ------------------
6
+
7
+ ### Added
8
+ - Support for mutl-value options in unit file
9
+ - Enforcement of Fleet service naming conventions
10
+
4
11
  0.6.1 - 2014-09-20
5
12
  ------------------
6
13
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fleet-api (0.6.1)
4
+ fleet-api (0.8.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.6.0 of Fleet.
17
+ The current version of the *fleet-api* gem is known to work with version 0.8.0 of Fleet.
18
18
 
19
19
  ### Installation
20
20
 
data/lib/fleet/client.rb CHANGED
@@ -34,6 +34,10 @@ module Fleet
34
34
 
35
35
  def load(name, service_def=nil, sync=false)
36
36
 
37
+ unless name =~ /\A[a-zA-Z0-9:_.@-]+\Z/
38
+ raise ArgumentError, 'name may only contain [a-zA-Z0-9:_.@-]'
39
+ end
40
+
37
41
  if service_def
38
42
  unless service_def.is_a?(ServiceDefinition)
39
43
  service_def = ServiceDefinition.new(name, service_def)
@@ -35,7 +35,11 @@ module Fleet
35
35
 
36
36
  if section.is_a?(Enumerable)
37
37
  section.each do |key, value|
38
- raw_string += "#{key}=#{value}\n"
38
+ if value.is_a?(Enumerable)
39
+ value.each { |command| raw_string += "#{key}=#{command}\n" }
40
+ else
41
+ raw_string += "#{key}=#{value}\n"
42
+ end
39
43
  end
40
44
  end
41
45
 
data/lib/fleet/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fleet
2
- VERSION = '0.6.1'.freeze unless defined?(Fleet::VERSION)
2
+ VERSION = '0.8.0'.freeze unless defined?(Fleet::VERSION)
3
3
  end
@@ -162,6 +162,15 @@ describe Fleet::Client do
162
162
  end
163
163
  end
164
164
  end
165
+
166
+ context 'when the supplied name is invalid' do
167
+
168
+ let(:name) { 'foo!.service' }
169
+
170
+ it 'raises an ArgumentError' do
171
+ expect { subject.load(name, nil) }.to raise_error(ArgumentError, /only contain/)
172
+ end
173
+ end
165
174
  end
166
175
 
167
176
  describe '#start' do
@@ -10,6 +10,7 @@ describe Fleet::ServiceDefinition do
10
10
  'Description' => 'infinite loop'
11
11
  },
12
12
  'Service' => {
13
+ 'ExecStartPre' => ['foo', 'bar'],
13
14
  'ExecStart' => "/bin/bash -c \"while true; do sleep 1; done\""
14
15
  }
15
16
  }
@@ -41,6 +42,8 @@ describe Fleet::ServiceDefinition do
41
42
  Description=#{service_hash['Unit']['Description']}
42
43
 
43
44
  [Service]
45
+ ExecStartPre=#{service_hash['Service']['ExecStartPre'].first}
46
+ ExecStartPre=#{service_hash['Service']['ExecStartPre'].last}
44
47
  ExecStart=#{service_hash['Service']['ExecStart']}
45
48
  UNIT_FILE
46
49
 
@@ -58,7 +61,7 @@ UNIT_FILE
58
61
 
59
62
  expected = {
60
63
  'Name' => name,
61
- 'UnitHash' => [111, 150, 87, 109, 217, 26, 190, 221, 31, 28, 8, 211, 198, 126, 76, 157, 106, 164, 220, 134]
64
+ 'UnitHash' => [173,163,19,156,23,184,6,223,77,240,208,230,238,54,179,201,80,147,228,89]
62
65
  }
63
66
 
64
67
  expect(subject.to_job).to eq expected
@@ -70,7 +73,7 @@ UNIT_FILE
70
73
  subject { described_class.new(name, service_hash) }
71
74
 
72
75
  it 'generates the appropriate sha1 hash' do
73
- expect(subject.sha1).to eq '6f96576dd91abedd1f1c08d3c67e4c9d6aa4dc86'
76
+ expect(subject.sha1).to eq 'ada3139c17b806df4df0d0e6ee36b3c95093e459'
74
77
  end
75
78
  end
76
79
  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.6.1
4
+ version: 0.8.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-09-20 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday