blob: ea0f774b8d977fe6f319733c8bfa029802c4f865 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: true
module QA
module Service
module DockerRun
class LDAP < Base
def initialize(volume)
@image = 'osixia/openldap:latest'
@name = 'ldap-server'
@volume = volume
super()
end
def register!
shell <<~CMD.tr("\n", ' ')
docker run -d --rm
--network #{network}
--hostname #{host_name}
--name #{@name}
-p 389:389
--volume #{volume_or_fixture(@volume)}:/container/service/slapd/assets/config/bootstrap/ldif/custom
#{@image} --copy-service
CMD
end
def volume_or_fixture(volume_name)
if volume_exists?(volume_name)
volume_name
else
Runtime::Path.fixture('ldap', volume_name)
end
end
def volume_exists?(volume_name)
`docker volume ls -q -f name=#{volume_name}`.include?(volume_name)
end
end
end
end
end
|