Skip to content

Commit 3783d48

Browse files
committed
Add support for Ubuntu
1 parent c3586e3 commit 3783d48

File tree

5 files changed

+98
-20
lines changed

5 files changed

+98
-20
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,24 @@ Fedora users can get GlusterFS packages directly from Fedora's repository. Red H
5555
gluster::repo => false
5656
```
5757

58-
For systems using APT, the latest packages of the latest release will be installed by default. Otherwise, specify a version:
58+
For Debian, the latest packages of the latest release will be installed by default. Otherwise, specify a version:
5959

6060
```puppet
6161
class { ::gluster::repo:
6262
version => '3.5.2',
6363
}
6464
```
6565

66+
For Ubuntu, the [Gluster PPA](https://launchpad.net/~gluster) repositories only contain the latest version of each release.
67+
Therefore specify the release to install:
68+
69+
```puppet
70+
class { ::gluster::repo:
71+
release => '10',
72+
}
73+
```
74+
75+
6676
For systems using YUM, the latest package from the 3.8 release branch will be installed. You can specify a specific version and release:
6777

6878
```puppet

manifests/repo/apt.pp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,32 @@
8282
}
8383
}
8484
}
85+
'Ubuntu': {
86+
$repo_key_name = 'F7C73FCC930AC9F83B387A5613E01B7B3FE869A9'
87+
$repo_key_source = undef
88+
89+
unless $version == 'LATEST' {
90+
fail("Specifying version other than LATEST doesn't make sense for Ubuntu PPA!")
91+
}
92+
$repo_ver = $version
93+
94+
$_release = versioncmp($release, '4.1') ? {
95+
1 => $release.match(/\A[^.]*/)[0],
96+
default => $release,
97+
}
98+
99+
$arch = $facts['os']['architecture'] ? {
100+
'amd64' => 'amd64',
101+
'arm64' => 'arm64',
102+
'armhf' => 'armhf',
103+
'i386' => 'i386',
104+
default => false,
105+
}
106+
107+
$repo_url = "http://ppa.launchpad.net/gluster/glusterfs-${_release}/ubuntu"
108+
}
85109
default: {
86-
fail('gluster::repo::apt currently only works on Debian')
110+
fail('gluster::repo::apt currently only works on Debian and Ubuntu')
87111
}
88112
}
89113

metadata.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
"11",
4141
"12"
4242
]
43+
},
44+
{
45+
"operatingsystem": "Ubuntu",
46+
"operatingsystemrelease": [
47+
"18.04",
48+
"20.04"
49+
]
4350
}
4451
],
4552
"dependencies": [

spec/classes/client_spec.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,19 @@
6969
}
7070
end
7171

72-
it 'includes gluster::install with version 3.6.1' do
73-
is_expected.to create_class('gluster::install').with(
74-
repo: true,
75-
client_package: 'glusterfs-client',
76-
version: '3.6.1'
77-
)
72+
case facts[:os][:name]
73+
when 'Debian'
74+
it 'includes gluster::install with version 3.6.1' do
75+
is_expected.to create_class('gluster::install').with(
76+
repo: true,
77+
client_package: 'glusterfs-client',
78+
version: '3.6.1'
79+
)
80+
end
81+
when 'Ubuntu'
82+
it 'does not install' do
83+
is_expected.to compile.and_raise_error(%r{Specifying version other than LATEST doesn't make sense for Ubuntu PPA!})
84+
end
7885
end
7986
end
8087
context 'when repo is false' do

spec/classes/repo_apt_spec.rb

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
it { is_expected.to contain_class('gluster::repo::apt') }
1111
it { is_expected.to compile.with_all_deps }
1212
it 'installs' do
13+
location = {
14+
'Debian' => "https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
15+
'Ubuntu' => 'http://ppa.launchpad.net/gluster/glusterfs-7/ubuntu',
16+
}
1317
is_expected.to contain_apt__source('glusterfs-LATEST').with(
1418
repos: 'main',
1519
release: facts[:lsbdistcodename].to_s,
16-
location: "https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
20+
location: location[facts[:os]['name']]
1721
)
1822
end
1923
end
@@ -39,10 +43,14 @@
3943
end
4044

4145
it 'installs' do
46+
location = {
47+
'Debian' => "https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
48+
'Ubuntu' => 'http://ppa.launchpad.net/gluster/glusterfs-7/ubuntu',
49+
}
4250
is_expected.to contain_apt__source('glusterfs-LATEST').with(
4351
repos: 'main',
4452
release: facts[:lsbdistcodename].to_s,
45-
location: "https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
53+
location: location[facts[:os]['name']],
4654
pin: '700'
4755
)
4856
end
@@ -56,14 +64,25 @@
5664
end
5765

5866
it 'installs' do
67+
location = {
68+
'Debian' => "https://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/",
69+
'Ubuntu' => 'http://ppa.launchpad.net/gluster/glusterfs-4.1/ubuntu',
70+
}
71+
key = {
72+
'Debian' => {
73+
'id' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
74+
'source' => 'https://download.gluster.org/pub/gluster/glusterfs/4.1/rsa.pub',
75+
},
76+
'Ubuntu' => {
77+
'id' => 'F7C73FCC930AC9F83B387A5613E01B7B3FE869A9',
78+
'source' => nil,
79+
},
80+
}
5981
is_expected.to contain_apt__source('glusterfs-LATEST').with(
6082
repos: 'main',
6183
release: facts[:lsbdistcodename].to_s,
62-
key: {
63-
'id' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
64-
'source' => 'https://download.gluster.org/pub/gluster/glusterfs/4.1/rsa.pub'
65-
},
66-
location: "https://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
84+
key: key[facts[:os]['name']],
85+
location: location[facts[:os]['name']]
6786
)
6887
end
6988
end
@@ -76,14 +95,25 @@
7695
end
7796

7897
it 'installs' do
98+
location = {
99+
'Debian' => "https://download.gluster.org/pub/gluster/glusterfs/01.old-releases/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/",
100+
'Ubuntu' => 'http://ppa.launchpad.net/gluster/glusterfs-3.12/ubuntu',
101+
}
102+
key = {
103+
'Debian' => {
104+
'id' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
105+
'source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.12/rsa.pub',
106+
},
107+
'Ubuntu' => {
108+
'id' => 'F7C73FCC930AC9F83B387A5613E01B7B3FE869A9',
109+
'source' => nil,
110+
},
111+
}
79112
is_expected.to contain_apt__source('glusterfs-LATEST').with(
80113
repos: 'main',
81114
release: facts[:lsbdistcodename].to_s,
82-
key: {
83-
'id' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
84-
'source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.12/rsa.pub'
85-
},
86-
location: "https://download.gluster.org/pub/gluster/glusterfs/01.old-releases/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
115+
key: key[facts[:os]['name']],
116+
location: location[facts[:os]['name']]
87117
)
88118
end
89119
end

0 commit comments

Comments
 (0)