smart_proxy_omaha 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -4
- data/Rakefile +1 -1
- data/lib/smart_proxy_omaha/metadata.rb +3 -1
- data/lib/smart_proxy_omaha/metadata_provider.rb +8 -5
- data/lib/smart_proxy_omaha/omaha_protocol/handler.rb +2 -2
- data/lib/smart_proxy_omaha/omaha_protocol/request.rb +1 -1
- data/lib/smart_proxy_omaha/omaha_protocol/updateresponse.rb +1 -1
- data/lib/smart_proxy_omaha/release.rb +12 -8
- data/lib/smart_proxy_omaha/release_provider.rb +5 -3
- data/lib/smart_proxy_omaha/release_repository.rb +4 -4
- data/lib/smart_proxy_omaha/version.rb +1 -1
- data/smart_proxy_omaha.gemspec +10 -4
- data/test/fixtures/response_update_complete_update.xml +1 -1
- data/test/omaha/metadata_provider_test.rb +6 -3
- data/test/omaha/omaha_api_test.rb +8 -7
- data/test/omaha/omaha_protocol/request_test.rb +2 -2
- data/test/omaha/release_provider_test.rb +2 -2
- data/test/omaha/release_test.rb +21 -11
- data/test/test_helper.rb +1 -0
- metadata +45 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3153cfdac54b440908156dbada4b9af261c53cd5
|
4
|
+
data.tar.gz: f35c54968e7f16b970c8e34434dfef41afa8bebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126dc938473bd16fb5c3cdf64d4fef7800610f22ac86473d989b654b75126c2ccb1c8bd0f05b28183de756668f156ba21bb298a3dd083bb52d5b199d9e0ebd9f
|
7
|
+
data.tar.gz: e40cc9ad0d51dcaf14fdc61a2769daa70bf4da74ce8c676208c55c0b6d6c134a91b8d9723ab83345bf49650649d20c9e825351359d043091b706052a20227e9c
|
data/Gemfile
CHANGED
@@ -2,13 +2,21 @@ source 'https://rubygems.org'
|
|
2
2
|
gemspec
|
3
3
|
|
4
4
|
group :development do
|
5
|
-
|
6
|
-
gem '
|
7
|
-
gem 'rubocop', '0.38.0'
|
5
|
+
gem 'smart_proxy', :git => 'https://github.com/theforeman/smart-proxy.git', :branch => 'develop'
|
6
|
+
gem 'rubocop', '0.38.0' if RUBY_VERSION > '1.8.7'
|
8
7
|
end
|
9
8
|
|
10
9
|
group :test do
|
11
10
|
gem 'rack-test'
|
12
11
|
gem 'single_test'
|
13
|
-
gem '
|
12
|
+
gem 'test_xml'
|
13
|
+
|
14
|
+
if RUBY_VERSION < '1.9.3'
|
15
|
+
gem 'webmock', '< 2.0.0'
|
16
|
+
else
|
17
|
+
gem 'webmock'
|
18
|
+
end
|
14
19
|
end
|
20
|
+
|
21
|
+
gem 'addressable', '< 2.2.0', :platforms => :ruby_18
|
22
|
+
gem 'json', '~> 1.0', :platforms => [:ruby_18, :ruby_19]
|
data/Rakefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Proxy::Omaha
|
2
2
|
class Metadata
|
3
|
-
attr_accessor :release, :sha1_b64, :sha256_b64, :size, :track
|
3
|
+
attr_accessor :release, :sha1_b64, :sha256_b64, :size, :track, :architecture
|
4
4
|
|
5
5
|
def initialize(params)
|
6
6
|
symbolize_keys_deep!(params)
|
7
7
|
@release = params.fetch(:release)
|
8
|
+
@architecture = params.fetch(:architecture)
|
8
9
|
@sha1_b64 = params.fetch(:sha1_b64)
|
9
10
|
@sha256_b64 = params.fetch(:sha256_b64)
|
10
11
|
@size = params.fetch(:size)
|
@@ -14,6 +15,7 @@ module Proxy::Omaha
|
|
14
15
|
def to_json
|
15
16
|
{
|
16
17
|
:release => release,
|
18
|
+
:architecture => architecture,
|
17
19
|
:sha1_b64 => sha1_b64,
|
18
20
|
:sha256_b64 => sha256_b64,
|
19
21
|
:size => size,
|
@@ -6,18 +6,21 @@ module Proxy::Omaha
|
|
6
6
|
@contentpath = options.fetch(:contentpath)
|
7
7
|
end
|
8
8
|
|
9
|
-
def get(track, release)
|
10
|
-
Metadata.new(JSON.parse(File.read(metadata_file(track, release))))
|
9
|
+
def get(track, release, architecture)
|
10
|
+
Metadata.new(JSON.parse(File.read(metadata_file(track, release, architecture))))
|
11
11
|
end
|
12
12
|
|
13
13
|
def store(metadata)
|
14
|
-
File.
|
14
|
+
File.open(metadata_file(metadata.track, metadata.release, metadata.architecture), 'w') do |file|
|
15
|
+
file.write(metadata.to_json)
|
16
|
+
end
|
17
|
+
true
|
15
18
|
end
|
16
19
|
|
17
20
|
private
|
18
21
|
|
19
|
-
def metadata_file(track, release)
|
20
|
-
File.join(contentpath, track, release.to_s, 'metadata.json')
|
22
|
+
def metadata_file(track, release, architecture)
|
23
|
+
File.join(contentpath, track, architecture, release.to_s, 'metadata.json')
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
@@ -65,11 +65,11 @@ module Proxy::Omaha::OmahaProtocol
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def handle_update
|
68
|
-
latest_os = repository.latest_os(request.track)
|
68
|
+
latest_os = repository.latest_os(request.track, request.board)
|
69
69
|
if !latest_os.nil? && latest_os > Gem::Version.new(request.version)
|
70
70
|
Proxy::Omaha::OmahaProtocol::Updateresponse.new(
|
71
71
|
:appid => request.appid,
|
72
|
-
:metadata => metadata_provider.get(request.track, latest_os),
|
72
|
+
:metadata => metadata_provider.get(request.track, latest_os, request.board),
|
73
73
|
:board => request.board,
|
74
74
|
:base_url => request.base_url
|
75
75
|
)
|
@@ -50,7 +50,7 @@ module Proxy::Omaha::OmahaProtocol
|
|
50
50
|
|
51
51
|
def parse_request
|
52
52
|
xml_request = Nokogiri::XML(body)
|
53
|
-
@appid = xml_request.xpath('/request/app/@appid').to_s.
|
53
|
+
@appid = xml_request.xpath('/request/app/@appid').to_s.tr('{}', '')
|
54
54
|
@version = xml_request.xpath('/request/app/@version').to_s
|
55
55
|
@osmajor = version.gsub(/^(\d+)\.\d\.\d$/, '\1')
|
56
56
|
@osminor = version.gsub(/^\d+\.(\d\.\d)$/, '\1')
|
@@ -19,7 +19,7 @@ module Proxy::Omaha::OmahaProtocol
|
|
19
19
|
def xml_response(xml)
|
20
20
|
xml.updatecheck(:status => 'ok') do
|
21
21
|
xml.urls do
|
22
|
-
xml.url(:codebase => "#{base_url}/omahareleases/#{track}/#{release}/")
|
22
|
+
xml.url(:codebase => "#{base_url}/omahareleases/#{track}/#{architecture}/#{release}/")
|
23
23
|
end
|
24
24
|
xml.manifest(:version => release) do
|
25
25
|
xml.packages do
|
@@ -6,19 +6,20 @@ module Proxy::Omaha
|
|
6
6
|
class Release
|
7
7
|
include Proxy::Log
|
8
8
|
|
9
|
-
attr_accessor :track, :version
|
9
|
+
attr_accessor :track, :version, :architecture
|
10
10
|
|
11
11
|
def initialize(options)
|
12
12
|
@track = options.fetch(:track).to_s
|
13
|
+
@architecture = options.fetch(:architecture)
|
13
14
|
@version = Gem::Version.new(options.fetch(:version))
|
14
15
|
end
|
15
16
|
|
16
17
|
def path
|
17
|
-
@path ||= File.join(Proxy::Omaha::Plugin.settings.contentpath, track, version.to_s)
|
18
|
+
@path ||= File.join(Proxy::Omaha::Plugin.settings.contentpath, track, architecture, version.to_s)
|
18
19
|
end
|
19
20
|
|
20
21
|
def metadata
|
21
|
-
metadata_provider.get(track, release)
|
22
|
+
metadata_provider.get(track, release, architecture)
|
22
23
|
end
|
23
24
|
|
24
25
|
def exists?
|
@@ -30,7 +31,7 @@ module Proxy::Omaha
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def create
|
33
|
-
logger.debug "Creating #{track} #{version}"
|
34
|
+
logger.debug "Creating #{track} #{version} #{architecture}"
|
34
35
|
return false unless create_path
|
35
36
|
return false unless download
|
36
37
|
return false unless create_metadata
|
@@ -43,7 +44,7 @@ module Proxy::Omaha
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def ==(other)
|
46
|
-
self.class === other && track == other.track && version == other.version
|
47
|
+
self.class === other && track == other.track && version == other.version && architecture == other.architecture
|
47
48
|
end
|
48
49
|
|
49
50
|
def to_s
|
@@ -65,9 +66,10 @@ module Proxy::Omaha
|
|
65
66
|
metadata_provider.store(Metadata.new(
|
66
67
|
:track => track,
|
67
68
|
:release => version.to_s,
|
69
|
+
:architecture => architecture,
|
68
70
|
:size => File.size(updatefile),
|
69
71
|
:sha1_b64 => Digest::SHA1.file(updatefile).base64digest,
|
70
|
-
:sha256_b64 => Digest::SHA256.file(updatefile).base64digest
|
72
|
+
:sha256_b64 => Digest::SHA256.file(updatefile).base64digest
|
71
73
|
))
|
72
74
|
true
|
73
75
|
rescue
|
@@ -86,11 +88,13 @@ module Proxy::Omaha
|
|
86
88
|
end
|
87
89
|
|
88
90
|
def sources
|
89
|
-
upstream = "https://#{track}.release.core-os.net
|
91
|
+
upstream = "https://#{track}.release.core-os.net/#{architecture}/#{version}"
|
90
92
|
[
|
91
93
|
"#{upstream}/coreos_production_pxe.vmlinuz",
|
94
|
+
"#{upstream}/coreos_production_image.bin.bz2",
|
95
|
+
"#{upstream}/coreos_production_image.bin.bz2.sig",
|
92
96
|
"#{upstream}/coreos_production_pxe_image.cpio.gz",
|
93
|
-
"https://update.release.core-os.net
|
97
|
+
"https://update.release.core-os.net/#{architecture}/#{version}/update.gz"
|
94
98
|
]
|
95
99
|
end
|
96
100
|
|
@@ -9,9 +9,11 @@ module Proxy::Omaha
|
|
9
9
|
include HttpShared
|
10
10
|
|
11
11
|
attr_accessor :track
|
12
|
+
attr_accessor :architecture
|
12
13
|
|
13
14
|
def initialize(options)
|
14
15
|
@track = options.fetch(:track)
|
16
|
+
@architecture = options.fetch(:architecture, 'amd64-usr')
|
15
17
|
end
|
16
18
|
|
17
19
|
def releases
|
@@ -19,12 +21,12 @@ module Proxy::Omaha
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def fetch_releases
|
22
|
-
releases = http_request.get("https://#{track}.release.core-os.net/
|
24
|
+
releases = http_request.get("https://#{track}.release.core-os.net/#{architecture}/")
|
23
25
|
xml = Nokogiri::HTML(releases)
|
24
26
|
parsed = (xml.xpath('//a/text()').map(&:to_s) - ['current']).map do |v|
|
25
|
-
Proxy::Omaha::Release.new(:version => v, :track => track)
|
27
|
+
Proxy::Omaha::Release.new(:version => v, :track => track, :architecture => architecture)
|
26
28
|
end.sort
|
27
|
-
logger.debug "Fetched releases for #{track}: #{parsed.map(&:to_s).join(', ')}"
|
29
|
+
logger.debug "Fetched releases for #{architecture}/#{track}: #{parsed.map(&:to_s).join(', ')}"
|
28
30
|
parsed
|
29
31
|
end
|
30
32
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Proxy::Omaha
|
2
2
|
class ReleaseRepository
|
3
|
-
def releases(track)
|
4
|
-
Dir.glob(File.join(Proxy::Omaha::Plugin.settings.contentpath, track, '*')).select {|f| File.directory? f }.map { |f| Gem::Version.new(File.basename(f)) }
|
3
|
+
def releases(track, architecture)
|
4
|
+
Dir.glob(File.join(Proxy::Omaha::Plugin.settings.contentpath, track, architecture, '*')).select {|f| File.directory? f }.map { |f| Gem::Version.new(File.basename(f)) }
|
5
5
|
end
|
6
6
|
|
7
|
-
def latest_os(track)
|
8
|
-
releases(track).max
|
7
|
+
def latest_os(track, architecture)
|
8
|
+
releases(track, architecture).max
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/smart_proxy_omaha.gemspec
CHANGED
@@ -14,10 +14,16 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = 'http://github.com/theforeman/smart_proxy_omaha'
|
15
15
|
s.license = 'GPLv3'
|
16
16
|
|
17
|
-
|
17
|
+
if RUBY_VERSION < '1.9'
|
18
|
+
s.add_dependency('nokogiri', '<= 1.5.11')
|
19
|
+
else
|
20
|
+
s.add_dependency('nokogiri', '>= 1.5.10')
|
21
|
+
end
|
18
22
|
s.add_dependency('json')
|
19
23
|
|
20
|
-
s.add_development_dependency('
|
21
|
-
s.add_development_dependency('mocha')
|
22
|
-
s.add_development_dependency('
|
24
|
+
s.add_development_dependency('test-unit', '~> 2')
|
25
|
+
s.add_development_dependency('mocha', '~> 1')
|
26
|
+
s.add_development_dependency('webmock', '~> 1')
|
27
|
+
s.add_development_dependency('rack-test', '~> 0')
|
28
|
+
s.add_development_dependency('rake', '~> 10')
|
23
29
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<app app_id="e96281a6-d1af-4bde-9a0a-97b76e56dc57" status="ok">
|
5
5
|
<updatecheck status="ok">
|
6
6
|
<urls>
|
7
|
-
<url codebase="http://example.org/omahareleases/stable/1122.2.0/"/>
|
7
|
+
<url codebase="http://example.org/omahareleases/stable/amd64-usr/1122.2.0/"/>
|
8
8
|
</urls>
|
9
9
|
<manifest version="1122.2.0">
|
10
10
|
<packages>
|
@@ -8,13 +8,15 @@ class MetadataProviderTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_get
|
11
|
-
File.expects(:read).with('/tmp/stable/1068.9.0/metadata.json').returns(stub_metadata.to_json)
|
12
|
-
metadata = @provider.get('stable', '1068.9.0')
|
11
|
+
File.expects(:read).with('/tmp/stable/amd64-usr/1068.9.0/metadata.json').returns(stub_metadata.to_json)
|
12
|
+
metadata = @provider.get('stable', '1068.9.0', 'amd64-usr')
|
13
13
|
assert_kind_of Proxy::Omaha::Metadata, metadata
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_store
|
17
|
-
|
17
|
+
file_handle = mock('file')
|
18
|
+
file_handle.expects(:write).with(stub_metadata.to_json)
|
19
|
+
File.expects(:open).with('/tmp/stable/amd64-usr/1068.9.0/metadata.json', 'w').yields(file_handle).once
|
18
20
|
metadata = Proxy::Omaha::Metadata.new(stub_metadata)
|
19
21
|
assert @provider.store(metadata)
|
20
22
|
end
|
@@ -24,6 +26,7 @@ class MetadataProviderTest < Test::Unit::TestCase
|
|
24
26
|
def stub_metadata
|
25
27
|
{
|
26
28
|
:release => '1068.9.0',
|
29
|
+
:architecture => 'amd64-usr',
|
27
30
|
:sha1_b64 => 'foo',
|
28
31
|
:sha256_b64 => 'bar',
|
29
32
|
:size => '123',
|
@@ -10,19 +10,20 @@ class TestForemanClient
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class TestReleaseRepository
|
13
|
-
def releases(track)
|
13
|
+
def releases(track, architecture)
|
14
14
|
['1068.9.0', '1122.2.0'].map { |release| Gem::Version.new(release) }
|
15
15
|
end
|
16
16
|
|
17
|
-
def latest_os(track)
|
18
|
-
releases(track).max
|
17
|
+
def latest_os(track, architecture)
|
18
|
+
releases(track, architecture).max
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
class TestMetadataProvider
|
23
|
-
def get(track, release)
|
23
|
+
def get(track, release, architecture)
|
24
24
|
Proxy::Omaha::Metadata.new(
|
25
25
|
:track => track,
|
26
|
+
:architecture => architecture,
|
26
27
|
:release => release,
|
27
28
|
:sha1_b64 => '+ZFmPWzv1OdfmKHaGSojbK5Xj3k=',
|
28
29
|
:sha256_b64 => 'cSBzKN0c6vKinrH0SdqUZSHlQtCa90vmeKC7p/xk19M=',
|
@@ -58,18 +59,18 @@ class OmahaApiTest < Test::Unit::TestCase
|
|
58
59
|
def test_processes_update_complete_noupdate
|
59
60
|
post "/v1/update", xml_fixture('request_update_complete_noupdate')
|
60
61
|
assert last_response.ok?, "Last response was not ok: #{last_response.status} #{last_response.body}"
|
61
|
-
|
62
|
+
assert_xml_equal xml_fixture('response_update_complete_noupdate'), last_response.body
|
62
63
|
end
|
63
64
|
|
64
65
|
def test_processes_update_complete_update
|
65
66
|
post "/v1/update", xml_fixture('request_update_complete_update')
|
66
67
|
assert last_response.ok?, "Last response was not ok: #{last_response.status} #{last_response.body}"
|
67
|
-
|
68
|
+
assert_xml_equal xml_fixture('response_update_complete_update'), last_response.body
|
68
69
|
end
|
69
70
|
|
70
71
|
def test_processes_update_complete_error
|
71
72
|
post "/v1/update", xml_fixture('request_update_complete_error')
|
72
73
|
assert last_response.ok?, "Last response was not ok: #{last_response.status} #{last_response.body}"
|
73
|
-
|
74
|
+
assert_xml_equal xml_fixture('response_update_complete_error'), last_response.body
|
74
75
|
end
|
75
76
|
end
|
@@ -8,7 +8,7 @@ class RequestTest < Test::Unit::TestCase
|
|
8
8
|
@request = Proxy::Omaha::OmahaProtocol::Request.new(
|
9
9
|
xml_fixture('request_update_complete_update'),
|
10
10
|
:ip => '1.1.1.1',
|
11
|
-
:base_url => 'http://www.example.org/'
|
11
|
+
:base_url => 'http://www.example.org/'
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
@@ -68,7 +68,7 @@ class RequestTest < Test::Unit::TestCase
|
|
68
68
|
request6 = Proxy::Omaha::OmahaProtocol::Request.new(
|
69
69
|
xml_fixture('request_update_complete_update'),
|
70
70
|
:ip => '2001:db8::1',
|
71
|
-
:base_url => 'http://www.example.org/'
|
71
|
+
:base_url => 'http://www.example.org/'
|
72
72
|
)
|
73
73
|
|
74
74
|
assert_nil request6.ipaddress
|
@@ -4,7 +4,7 @@ require 'smart_proxy_omaha/release_provider'
|
|
4
4
|
|
5
5
|
class ReleaseProviderTest < Test::Unit::TestCase
|
6
6
|
def setup
|
7
|
-
@provider = Proxy::Omaha::ReleaseProvider.new(:track => :stable)
|
7
|
+
@provider = Proxy::Omaha::ReleaseProvider.new(:track => :stable, :architecture => 'amd64-usr')
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_releases
|
@@ -54,6 +54,6 @@ class ReleaseProviderTest < Test::Unit::TestCase
|
|
54
54
|
'1068.10.0',
|
55
55
|
'1122.2.0']
|
56
56
|
|
57
|
-
assert_equal expected.map {|v| Proxy::Omaha::Release.new(:track => @provider.track, :version => v) }, @provider.releases
|
57
|
+
assert_equal expected.map {|v| Proxy::Omaha::Release.new(:track => @provider.track, :version => v, :architecture => 'amd64-usr') }, @provider.releases
|
58
58
|
end
|
59
59
|
end
|
data/test/omaha/release_test.rb
CHANGED
@@ -14,7 +14,8 @@ class ReleaseTest < Test::Unit::TestCase
|
|
14
14
|
)
|
15
15
|
@release = Proxy::Omaha::Release.new(
|
16
16
|
:track => :stable,
|
17
|
-
:
|
17
|
+
:architecture => 'amd64-usr',
|
18
|
+
:version => '1068.9.0'
|
18
19
|
)
|
19
20
|
end
|
20
21
|
|
@@ -23,7 +24,7 @@ class ReleaseTest < Test::Unit::TestCase
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def test_path
|
26
|
-
assert_equal "#{@contentpath}/stable/1068.9.0", @release.path
|
27
|
+
assert_equal "#{@contentpath}/stable/amd64-usr/1068.9.0", @release.path
|
27
28
|
end
|
28
29
|
|
29
30
|
def test_exists?
|
@@ -54,11 +55,13 @@ class ReleaseTest < Test::Unit::TestCase
|
|
54
55
|
def test_compare
|
55
56
|
older = Proxy::Omaha::Release.new(
|
56
57
|
:track => :stable,
|
57
|
-
:
|
58
|
+
:architecture => 'amd64-usr',
|
59
|
+
:version => '100.0.0'
|
58
60
|
)
|
59
61
|
newer = Proxy::Omaha::Release.new(
|
60
62
|
:track => :stable,
|
61
|
-
:
|
63
|
+
:architecture => 'amd64-usr',
|
64
|
+
:version => '2000.0.0'
|
62
65
|
)
|
63
66
|
assert_equal 0, @release.<=>(@release)
|
64
67
|
assert_equal -1, @release.<=>(newer)
|
@@ -68,7 +71,8 @@ class ReleaseTest < Test::Unit::TestCase
|
|
68
71
|
def test_equality
|
69
72
|
other = Proxy::Omaha::Release.new(
|
70
73
|
:track => :stable,
|
71
|
-
:
|
74
|
+
:architecture => 'amd64-usr',
|
75
|
+
:version => '100.0.0'
|
72
76
|
)
|
73
77
|
assert_equal @release, @release
|
74
78
|
refute_equal other, @release
|
@@ -81,14 +85,20 @@ class ReleaseTest < Test::Unit::TestCase
|
|
81
85
|
|
82
86
|
def test_download
|
83
87
|
stub_request(:get, /.*release\.core-os.*/).to_return(:status => [200, 'OK'], :body => "body")
|
84
|
-
expected = [
|
88
|
+
expected = [
|
89
|
+
'coreos_production_pxe.vmlinuz',
|
90
|
+
'coreos_production_pxe_image.cpio.gz',
|
91
|
+
'coreos_production_image.bin.bz2',
|
92
|
+
'coreos_production_image.bin.bz2.sig',
|
93
|
+
'update.gz'
|
94
|
+
]
|
85
95
|
|
86
96
|
assert_equal true, @release.create_path
|
87
97
|
assert_equal true, @release.download
|
88
98
|
|
89
|
-
|
90
|
-
|
91
|
-
|
99
|
+
existing_files = Dir.entries(@release.path) - ['.', '..']
|
100
|
+
|
101
|
+
assert_equal expected.sort, existing_files.sort
|
92
102
|
end
|
93
103
|
|
94
104
|
def test_create_metadata
|
@@ -100,11 +110,11 @@ class ReleaseTest < Test::Unit::TestCase
|
|
100
110
|
Digest::SHA1.expects(:file).once.returns(digest)
|
101
111
|
Digest::SHA256.expects(:file).once.returns(digest)
|
102
112
|
|
103
|
-
expected = '{"release":"1068.9.0","sha1_b64":"foo","sha256_b64":"foo","size":0,"track":"stable"}'
|
113
|
+
expected = '{"release":"1068.9.0","architecture":"amd64-usr","sha1_b64":"foo","sha256_b64":"foo","size":0,"track":"stable"}'
|
104
114
|
|
105
115
|
assert_equal true, @release.create_path
|
106
116
|
assert_equal true, @release.create_metadata
|
107
117
|
assert File.exist?(file)
|
108
|
-
assert_equal expected, File.read(file)
|
118
|
+
assert_equal JSON.parse(expected), JSON.parse(File.read(file))
|
109
119
|
end
|
110
120
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_omaha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Goebel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.5.10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.5.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,47 +39,75 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: test-unit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-test
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10'
|
83
111
|
description: This plug-in adds support for the Omaha Procotol to Foreman's Smart Proxy.
|
84
112
|
email: mail@timogoebel.name
|
85
113
|
executables:
|
@@ -159,9 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
187
|
version: '0'
|
160
188
|
requirements: []
|
161
189
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.6.12
|
163
191
|
signing_key:
|
164
192
|
specification_version: 4
|
165
193
|
summary: Omaha protocol support for smart-proxy
|
166
194
|
test_files: []
|
167
|
-
has_rdoc:
|