Skip to content

Commit 9ccc699

Browse files
authored
Merge pull request #1881 from lsst-it/IT-6370/rm-s3daemon-support
(profile::ccs::file_transfer) rm s3daemon support
2 parents 7a5ab20 + 03b46ed commit 9ccc699

File tree

3 files changed

+22
-182
lines changed

3 files changed

+22
-182
lines changed

site/profile/manifests/ccs/file_transfer.pp

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,8 @@
2323
# String specifying username for pkgurl
2424
# @param pkgurl_pass
2525
# String specifying password for pkgurl
26-
# @param s3daemon
27-
# Boolean, true to install s3daemon
28-
# @param s3daemon_repo_url
29-
# URL of the s3daemon repo
30-
# @param s3daemon_repo_rev
31-
# Git repository revision of s3daemon to install
32-
# @param s3daemon_repo_directory
33-
# String specifying s3daemon installation directory
34-
# @param s3daemon_env_file
35-
# String specifying s3daemon environment file
36-
# @param s3daemon_env_url
37-
# String giving s3daemon endpoint URL
38-
# @param s3daemon_env_access
39-
# String giving s3daemon access key
40-
# @param s3daemon_env_secret
41-
# String giving s3daemon secret key
4226
#
4327
class profile::ccs::file_transfer (
44-
Sensitive[String[1]] $s3daemon_env_access,
45-
Sensitive[String[1]] $s3daemon_env_secret,
46-
Boolean $s3daemon = true,
47-
Stdlib::HTTPUrl $s3daemon_repo_url = 'https://github.com/lsst-dm/s3daemon',
48-
Optional[String[1]] $s3daemon_repo_rev = undef,
49-
String $s3daemon_repo_directory = '/home/ccs-ipa/s3daemon/git',
50-
String $s3daemon_env_file = '/home/ccs-ipa/s3daemon/env',
51-
String $s3daemon_env_url = 'https://s3dfrgw.slac.stanford.edu',
5228
String $directory = '/home/ccs-ipa/bin',
5329
String $user = 'ccs-ipa',
5430
String $group = 'ccs-ipa',
@@ -70,124 +46,6 @@
7046
mode => '0755',
7147
})
7248

73-
## We expect that s3daemon will become the default (and only) method
74-
## some time soonish.
75-
if $s3daemon {
76-
case fact('os.release.major') {
77-
'7': {
78-
$pip_extra_packages = [
79-
'aiosignal',
80-
'async-timeout',
81-
'attrs',
82-
'charset-normalizer',
83-
'multidict',
84-
'typing_extensions',
85-
'yarl',
86-
'idna_ssl',
87-
]
88-
$yum_extra_packages = []
89-
}
90-
'8': {
91-
$pip_extra_packages = [
92-
'aiosignal',
93-
'idna_ssl',
94-
]
95-
$yum_extra_packages = [
96-
'python3-async-timeout',
97-
'python3-attrs',
98-
'python3-charset-normalizer',
99-
'python3-multidict',
100-
'python3-typing-extensions',
101-
'python3-yarl',
102-
]
103-
}
104-
default: {
105-
$pip_extra_packages = []
106-
$yum_extra_packages = [
107-
'python3-aiosignal',
108-
'python3-async-timeout',
109-
'python3-attrs',
110-
'python3-charset-normalizer',
111-
'python3-multidict',
112-
'python3-typing-extensions',
113-
'python3-yarl',
114-
]
115-
}
116-
}
117-
118-
$yum_packages = $yum_extra_packages + [
119-
'python3',
120-
'python3-pip',
121-
'python3-devel',
122-
]
123-
124-
$pip_packages = $pip_extra_packages + [
125-
'aiobotocore',
126-
]
127-
128-
ensure_packages($yum_packages)
129-
130-
package { $pip_packages:
131-
ensure => 'present',
132-
provider => 'pip3',
133-
require => Package['python3-pip'],
134-
}
135-
136-
$repo_parent = "${dirname($s3daemon_repo_directory)}"
137-
$env_parent = "${dirname($s3daemon_env_file)}"
138-
139-
$parents = [$repo_parent, $env_parent]
140-
141-
$parents.unique.each | String $direc | {
142-
file { $direc:
143-
ensure => directory,
144-
mode => '0755',
145-
owner => $user,
146-
group => $group,
147-
}
148-
}
149-
150-
$envfile_epp_vars = {
151-
url => $s3daemon_env_url,
152-
access => $s3daemon_env_access,
153-
secret => $s3daemon_env_secret,
154-
}
155-
156-
file { $s3daemon_env_file:
157-
content => epp("${module_name}/ccs/file_transfer/s3daemon_envfile.epp", $envfile_epp_vars),
158-
owner => $user,
159-
group => $group,
160-
mode => '0600',
161-
require => File[$env_parent],
162-
}
163-
164-
vcsrepo { $s3daemon_repo_directory:
165-
ensure => latest,
166-
provider => git,
167-
source => $s3daemon_repo_url,
168-
revision => $s3daemon_repo_rev,
169-
user => $user,
170-
require => File[$repo_parent],
171-
}
172-
173-
$epp_vars = {
174-
desc => 's3daemon file transfer service',
175-
user => $user,
176-
group => $group,
177-
cmd => "/usr/bin/python3 ${s3daemon_repo_directory}/python/s3daemon/s3daemon.py",
178-
workdir => "/home/${user}",
179-
envfile => $s3daemon_env_file,
180-
}
181-
182-
systemd::unit_file { 's3daemon.service':
183-
content => epp("${module_name}/ccs/service.epp", $epp_vars),
184-
}
185-
~> service { 's3daemon':
186-
ensure => 'running',
187-
enable => true,
188-
}
189-
} # s3daemon
190-
19149
file { $directory:
19250
ensure => directory,
19351
owner => $user,

spec/classes/ccs/file_transfer_spec.rb

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,29 @@
77
context "on #{os}" do
88
let(:facts) { os_facts }
99

10-
context 'with s3daemon' do
11-
let(:params) do
12-
{
13-
pkgurl: 'https://example.org',
14-
pkgurl_user: sensitive('user'),
15-
pkgurl_pass: sensitive('pass'),
16-
s3daemon: true,
17-
}
18-
end
19-
20-
it { is_expected.to compile.with_all_deps }
21-
22-
it { is_expected.to contain_file('/home/ccs-ipa/bin').with_ensure('directory') }
23-
24-
it { is_expected.to contain_file('/home/ccs-ipa/bin/ccs-push').with_ensure('link') }
25-
it { is_expected.to contain_file('/home/ccs-ipa/bin/compress').with_ensure('link') }
26-
it { is_expected.to contain_file('/home/ccs-ipa/bin/fpack-in-place').with_ensure('link') }
27-
it { is_expected.to contain_file('/home/ccs-ipa/bin/push-usdf').with_ensure('link') }
28-
29-
it { is_expected.to contain_file('/home/ccs-ipa/bin/mc-secret').with_mode('0600') }
30-
31-
it { is_expected.to contain_file('/home/ccs-ipa/bin/fhe').with_mode('0755') }
32-
it { is_expected.to contain_file('/home/ccs-ipa/bin/mc').with_mode('0755') }
33-
34-
it { is_expected.to contain_vcsrepo('/home/ccs-ipa/file-transfer') }
35-
36-
## s3daemon
37-
it { is_expected.to contain_vcsrepo('/home/ccs-ipa/s3daemon/git') }
38-
it { is_expected.to contain_file('/home/ccs-ipa/s3daemon/env').with_mode('0600') }
39-
40-
it do
41-
is_expected.to contain_service('s3daemon').with(
42-
ensure: 'running',
43-
enable: true
44-
)
45-
end
10+
let(:params) do
11+
{
12+
pkgurl: 'https://example.org',
13+
pkgurl_user: sensitive('user'),
14+
pkgurl_pass: sensitive('pass'),
15+
}
4616
end
17+
18+
it { is_expected.to compile.with_all_deps }
19+
20+
it { is_expected.to contain_file('/home/ccs-ipa/bin').with_ensure('directory') }
21+
22+
it { is_expected.to contain_file('/home/ccs-ipa/bin/ccs-push').with_ensure('link') }
23+
it { is_expected.to contain_file('/home/ccs-ipa/bin/compress').with_ensure('link') }
24+
it { is_expected.to contain_file('/home/ccs-ipa/bin/fpack-in-place').with_ensure('link') }
25+
it { is_expected.to contain_file('/home/ccs-ipa/bin/push-usdf').with_ensure('link') }
26+
27+
it { is_expected.to contain_file('/home/ccs-ipa/bin/mc-secret').with_mode('0600') }
28+
29+
it { is_expected.to contain_file('/home/ccs-ipa/bin/fhe').with_mode('0755') }
30+
it { is_expected.to contain_file('/home/ccs-ipa/bin/mc').with_mode('0755') }
31+
32+
it { is_expected.to contain_vcsrepo('/home/ccs-ipa/file-transfer') }
4733
end
4834
end
4935
end

spec/fixtures/hieradata/common.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ lookup_options:
1616
convert_to: "Sensitive"
1717
'^profile::ccs::common::pkgurl_.+$':
1818
convert_to: "Sensitive"
19-
'^profile::ccs::file_transfer::s3daemon_env_.+$':
20-
convert_to: "Sensitive"
2119
'^profile::ccs::file_transfer::secret$':
2220
convert_to: "Sensitive"
2321
'^restic::(id|key|password)$':
@@ -37,8 +35,6 @@ ipa::directory_services_password: "foofoofoofoo" # ipa master only
3735
ipa::domain_join_password: "foofoofoofoo" # 8 char min
3836
profile::ccs::common::pkgurl_pass: "foo"
3937
profile::ccs::common::pkgurl_user: "foo"
40-
profile::ccs::file_transfer::s3daemon_env_access: "foo"
41-
profile::ccs::file_transfer::s3daemon_env_secret: "foo"
4238
profile::ccs::file_transfer::secret: "foo"
4339
profile::ccs::postfix::auth: "foo"
4440
profile::core::ipam::password: "foo"

0 commit comments

Comments
 (0)