File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 20
20
# [*proxy*]
21
21
# Proxy to use for downloading Docker Compose.
22
22
#
23
+ # [*base_url*]
24
+ # The base url for installation
25
+ # This allows use of a mirror that follows the same layout as the
26
+ # official repository
27
+ #
28
+ # [*raw_url*]
29
+ # Override the raw URL for installation
30
+ # The default is to build a URL from baseurl. If rawurl is set, the caller is
31
+ # responsible for ensuring the URL points to the correct version and
32
+ # architecture.
33
+
23
34
class docker::compose (
24
35
Optional[Pattern[/^present $|^absent $/]] $ensure = ' present' ,
25
36
Optional[String] $version = $docker::params::compose_version,
26
37
Optional[String] $install_path = $docker::params::compose_install_path,
27
- Optional[String] $proxy = undef
38
+ Optional[String] $proxy = undef ,
39
+ Optional[String] $base_url = $docker::params::compose_base_url,
40
+ Optional[String] $raw_url = undef
28
41
) inherits docker::params {
29
42
30
43
if $proxy != undef {
43
56
$docker_compose_location_versioned = " ${install_path} /docker-compose-${version}${file_extension} "
44
57
45
58
if $ensure == ' present' {
46
- $docker_compose_url = " https://github.com/docker/compose/releases/download/${version} /docker-compose-${::kernel} -x86_64${file_extension} "
59
+
60
+ if $raw_url != undef {
61
+ $docker_compose_url = $raw_url
62
+ } else {
63
+ $docker_compose_url = " ${base_url} /${version} /docker-compose-${::kernel} -x86_64${file_extension} "
64
+ }
47
65
48
66
if $proxy != undef {
49
67
$proxy_opt = " --proxy ${proxy} "
Original file line number Diff line number Diff line change 68
68
$dns = undef
69
69
$dns_search = undef
70
70
$proxy = undef
71
+ $compose_base_url = ' https://github.com/docker/compose/releases/download'
71
72
$no_proxy = undef
72
73
$execdriver = undef
73
74
$storage_driver = undef
Original file line number Diff line number Diff line change 115
115
)
116
116
}
117
117
end
118
+
119
+ context 'when base_url is provided' do
120
+ let ( :params ) do
121
+ { base_url : 'http://example.org' ,
122
+ version : '1.7.0' }
123
+ end
124
+
125
+ it { is_expected . to compile }
126
+ it {
127
+ is_expected . to contain_exec ( 'Install Docker Compose 1.7.0' ) . with_command (
128
+ 'curl -s -S -L http://example.org/1.7.0/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose-1.7.0' ,
129
+ )
130
+ }
131
+ end
132
+
133
+ context 'when raw_url is provided' do
134
+ let ( :params ) do
135
+ { raw_url : 'http://example.org' ,
136
+ version : '1.7.0' }
137
+ end
138
+
139
+ it { is_expected . to compile }
140
+ it {
141
+ is_expected . to contain_exec ( 'Install Docker Compose 1.7.0' ) . with_command (
142
+ 'curl -s -S -L http://example.org -o /usr/local/bin/docker-compose-1.7.0' ,
143
+ )
144
+ }
145
+ end
118
146
end
You can’t perform that action at this time.
0 commit comments