fleet-api 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/fleet/client.rb +4 -0
- data/lib/fleet/service_definition.rb +5 -1
- data/lib/fleet/version.rb +1 -1
- data/spec/fleet/client_spec.rb +9 -0
- data/spec/fleet/service_definition_spec.rb +5 -2
- 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: 5c53fd4743be330713996996781ccfc244868131
|
4
|
+
data.tar.gz: 3e3fcb5fc7aa92b37944954975ea663dd2c7cb96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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
|
-
|
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
data/spec/fleet/client_spec.rb
CHANGED
@@ -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' => [
|
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 '
|
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.
|
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-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|