View | Details | Raw Unified | Return to bug 40463
Collapse All | Expand All

(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini (-2 lines)
 Lines 8-15    Link Here 
8
from dockertest import *
8
from dockertest import *
9
9
10
if __name__ == '__main__':
10
if __name__ == '__main__':
11
12
	docker_login()
11
	docker_login()
13
12
14
	docker_pull('ucs-appbox-amd64:4.1-0')
13
	docker_pull('ucs-appbox-amd64:4.1-0')
15
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3 (-5 lines)
 Lines 10-16   from univention.testing.utils import get_ldap_connection Link Here 
10
10
11
11
12
if __name__ == '__main__':
12
if __name__ == '__main__':
13
	
14
	with Appcenter() as appcenter:
13
	with Appcenter() as appcenter:
15
		appcenter.add_ucs_version_to_appcenter('4.0')
14
		appcenter.add_ucs_version_to_appcenter('4.0')
16
15
 Lines 21-27   if __name__ == '__main__': Link Here 
21
		app.ucs_version = '4.0'
20
		app.ucs_version = '4.0'
22
		app.add_to_local_appcenter()
21
		app.add_to_local_appcenter()
23
22
24
		
25
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
23
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
26
		app = App(name=app_name, version='1', build_package=False)
24
		app = App(name=app_name, version='1', build_package=False)
27
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
25
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
 Lines 38-44   if __name__ == '__main__': Link Here 
38
		app.add_to_local_appcenter()
36
		app.add_to_local_appcenter()
39
37
40
		try:
38
		try:
41
42
			appcenter.update()
39
			appcenter.update()
43
40
44
			app.install()
41
			app.install()
 Lines 48-55   if __name__ == '__main__': Link Here 
48
45
49
			lo = get_ldap_connection()
46
			lo = get_ldap_connection()
50
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionMemberServer))' % app_name, unique=True, required=True)
47
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionMemberServer))' % app_name, unique=True, required=True)
51
52
		finally:
48
		finally:
53
			app.uninstall()
49
			app.uninstall()
54
			app.remove()
50
			app.remove()
55
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install (-2 lines)
 Lines 9-15   from dockertest import * Link Here 
9
from univention.testing.utils import get_ldap_connection
9
from univention.testing.utils import get_ldap_connection
10
10
11
if __name__ == '__main__':
11
if __name__ == '__main__':
12
	
13
	with Appcenter() as appcenter:
12
	with Appcenter() as appcenter:
14
		app_name = get_app_name()
13
		app_name = get_app_name()
15
		app_version = get_app_version()
14
		app_version = get_app_version()
 Lines 31-34   if __name__ == '__main__': Link Here 
31
		finally:
30
		finally:
32
			app.uninstall()
31
			app.uninstall()
33
			app.remove()
32
			app.remove()
34
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave (-4 lines)
 Lines 16-22   import ldap Link Here 
16
import time
16
import time
17
17
18
if __name__ == '__main__':
18
if __name__ == '__main__':
19
	
20
	with Appcenter() as appcenter:
19
	with Appcenter() as appcenter:
21
		app_name = get_app_name()
20
		app_name = get_app_name()
22
		app_version = get_app_version()
21
		app_version = get_app_version()
 Lines 45-54   univention-install --yes --no-install-recommends univention-server-slave univent Link Here 
45
				print 'LDAP connection failed. Wait for ten seconds and try again.'
44
				print 'LDAP connection failed. Wait for ten seconds and try again.'
46
				time.sleep(60)
45
				time.sleep(60)
47
				lo = get_ldap_connection()
46
				lo = get_ldap_connection()
48
				
49
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionDomainController)(univentionServerRole=slave)(!(aRecord=*)))' % app_name, unique=True, required=True)
47
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionDomainController)(univentionServerRole=slave)(!(aRecord=*)))' % app_name, unique=True, required=True)
50
51
		finally:
48
		finally:
52
			app.uninstall()
49
			app.uninstall()
53
			app.remove()
50
			app.remove()
54
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage (-3 lines)
 Lines 10-16   from univention.testing.utils import fail Link Here 
10
from univention.testing.internal import package_installed
10
from univention.testing.internal import package_installed
11
11
12
if __name__ == '__main__':
12
if __name__ == '__main__':
13
	
14
	with Appcenter() as appcenter:
13
	with Appcenter() as appcenter:
15
		app_name = get_app_name()
14
		app_name = get_app_name()
16
		app_version = get_app_version()
15
		app_version = get_app_version()
 Lines 29-36   if __name__ == '__main__': Link Here 
29
			# The package must be installed locally
28
			# The package must be installed locally
30
			if not package_installed(app.package_name):
29
			if not package_installed(app.package_name):
31
				fail('The package %s is not installed locally.' % app.package_name)
30
				fail('The package %s is not installed locally.' % app.package_name)
32
			
33
		finally:
31
		finally:
34
			app.uninstall()
32
			app.uninstall()
35
			app.remove()
33
			app.remove()
36
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst (-1 / +1 lines)
 Lines 7-13    Link Here 
7
7
8
from dockertest import *
8
from dockertest import *
9
9
10
	
10
11
def create_app(fail_in_preinst):
11
def create_app(fail_in_preinst):
12
		app_name = get_app_name()
12
		app_name = get_app_name()
13
		app_version = get_app_version()
13
		app_version = get_app_version()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy (-3 lines)
 Lines 8-14    Link Here 
8
from dockertest import *
8
from dockertest import *
9
9
10
if __name__ == '__main__':
10
if __name__ == '__main__':
11
12
	with Appcenter() as appcenter:
11
	with Appcenter() as appcenter:
13
		app_name = get_app_name()
12
		app_name = get_app_name()
14
		app_version = get_app_version()
13
		app_version = get_app_version()
 Lines 31-39   if __name__ == '__main__': Link Here 
31
30
32
			app.install()
31
			app.install()
33
			app.verify()
32
			app.verify()
34
			
35
			app.verify_basic_modproxy_settings()
33
			app.verify_basic_modproxy_settings()
36
37
		finally:
34
		finally:
38
			app.uninstall()
35
			app.uninstall()
39
			app.remove()
36
			app.remove()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop (-2 lines)
 Lines 10-16   import subprocess Link Here 
10
import time
10
import time
11
11
12
if __name__ == '__main__':
12
if __name__ == '__main__':
13
14
	nscd_stopped = False
13
	nscd_stopped = False
15
14
16
	with Appcenter() as appcenter:
15
	with Appcenter() as appcenter:
 Lines 40-46   if __name__ == '__main__': Link Here 
40
			print ncs_container_pid_new
39
			print ncs_container_pid_new
41
			if ncs_container_pid_old != ncs_container_pid_new:
40
			if ncs_container_pid_old != ncs_container_pid_new:
42
				fail('nscd pid in container have been changed. old: [%s], new: [%s]' % (ncs_container_pid_old, ncs_container_pid_new))
41
				fail('nscd pid in container have been changed. old: [%s], new: [%s]' % (ncs_container_pid_old, ncs_container_pid_new))
43
44
		finally:
42
		finally:
45
			if nscd_stopped:
43
			if nscd_stopped:
46
				subprocess.call('/etc/init.d/nscd start', shell=True)
44
				subprocess.call('/etc/init.d/nscd start', shell=True)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package (-2 lines)
 Lines 9-15   from dockertest import * Link Here 
9
from univention.testing.utils import get_ldap_connection
9
from univention.testing.utils import get_ldap_connection
10
10
11
if __name__ == '__main__':
11
if __name__ == '__main__':
12
	
13
	with Appcenter() as appcenter:
12
	with Appcenter() as appcenter:
14
		app_name = get_app_name()
13
		app_name = get_app_name()
15
		app_version = get_app_version()
14
		app_version = get_app_version()
 Lines 40-43   if __name__ == '__main__': Link Here 
40
		finally:
39
		finally:
41
			app.uninstall()
40
			app.uninstall()
42
			app.remove()
41
			app.remove()
43
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation (-3 / +3 lines)
 Lines 10-21   from univention.testing.utils import fail, get_ldap_connection Link Here 
10
import os
10
import os
11
import subprocess
11
import subprocess
12
12
13
13
def fail_if_file_exists(f):
14
def fail_if_file_exists(f):
14
	if os.path.exists(f):
15
	if os.path.exists(f):
15
		fail('%s still exists' % f)
16
		fail('%s still exists' % f)
16
17
17
if __name__ == '__main__':
18
18
19
if __name__ == '__main__':
19
	with Appcenter() as appcenter:
20
	with Appcenter() as appcenter:
20
		app_name = get_app_name()
21
		app_name = get_app_name()
21
		app_version = get_app_version()
22
		app_version = get_app_version()
 Lines 42-48   echo "Test 123 Conf" >/var/lib/univention-appcenter/apps/%(app_name)s/conf/test1 Link Here 
42
43
43
			lo = get_ldap_connection()
44
			lo = get_ldap_connection()
44
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionMemberServer)(!(aRecord=*))(!(macAddress=*)))' % app_name, unique=True, required=True)
45
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionMemberServer)(!(aRecord=*))(!(macAddress=*)))' % app_name, unique=True, required=True)
45
			
46
		finally:
46
		finally:
47
			app.uninstall()
47
			app.uninstall()
48
			app.remove()
48
			app.remove()
 Lines 79-85   echo "Test 123 Conf" >/var/lib/univention-appcenter/apps/%(app_name)s/conf/test1 Link Here 
79
			fail('The LDAP object has not been removed: %s' % res)
79
			fail('The LDAP object has not been removed: %s' % res)
80
80
81
		# Check for the backup container
81
		# Check for the backup container
82
		res = subprocess.call('docker images  | grep appcenter-backup-%s' % app.app_name, shell=True)
82
		res = subprocess.call('docker images | grep appcenter-backup-%s' % app.app_name, shell=True)
83
		if res != 0:
83
		if res != 0:
84
			subprocess.call('docker images' % app.app_name, shell=True)
84
			subprocess.call('docker images' % app.app_name, shell=True)
85
			fail('Backup container appcenter-backup-%s was not found' % app.app_name)
85
			fail('Backup container appcenter-backup-%s was not found' % app.app_name)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature (-2 / +2 lines)
 Lines 35-41   class SyncedAppcenter(Appcenter): Link Here 
35
		d = os.path.dirname('/var/www/%s' % f)
35
		d = os.path.dirname('/var/www/%s' % f)
36
		if not os.path.exists(d):
36
		if not os.path.exists(d):
37
			os.makedirs(d)
37
			os.makedirs(d)
38
		
38
39
		call('wget -O /var/www/%s %s/%s' % (f, self.upstream_appcenter, f), shell=True)
39
		call('wget -O /var/www/%s %s/%s' % (f, self.upstream_appcenter, f), shell=True)
40
40
41
	def download_index_json(self):
41
	def download_index_json(self):
 Lines 43-49   class SyncedAppcenter(Appcenter): Link Here 
43
43
44
	def download_index_json_gpg(self):
44
	def download_index_json_gpg(self):
45
		self.download('meta-inf/%s/index.json.gz.gpg' % self.vv)
45
		self.download('meta-inf/%s/index.json.gz.gpg' % self.vv)
46
		
46
47
	def remove_from_cache(self, f):
47
	def remove_from_cache(self, f):
48
		if os.path.exists(os.path.join('/var/cache/univention-appcenter/', f)):
48
		if os.path.exists(os.path.join('/var/cache/univention-appcenter/', f)):
49
			os.remove(os.path.join('/var/cache/univention-appcenter/', f))
49
			os.remove(os.path.join('/var/cache/univention-appcenter/', f))
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify (-4 / +3 lines)
 Lines 7-16    Link Here 
7
7
8
from dockertest import *
8
from dockertest import *
9
9
10
class UCSTest_DockerApp_Identify(UCSTest_Docker_Exception): pass
10
class UCSTest_DockerApp_Identify(UCSTest_Docker_Exception):
11
	pass
12
11
13
12
if __name__ == '__main__':
14
if __name__ == '__main__':
13
	
14
	with Appcenter() as appcenter:
15
	with Appcenter() as appcenter:
15
		app_name = get_app_name()
16
		app_name = get_app_name()
16
		app_version = get_app_version()
17
		app_version = get_app_version()
 Lines 31-38   if __name__ == '__main__': Link Here 
31
			print 'Identify: %s' % identify
32
			print 'Identify: %s' % identify
32
			if identify.strip() != 'Docker App':
33
			if identify.strip() != 'Docker App':
33
				raise UCSTest_DockerApp_Identify()
34
				raise UCSTest_DockerApp_Identify()
34
35
		finally:
35
		finally:
36
			app.uninstall()
36
			app.uninstall()
37
			app.remove()
37
			app.remove()
38
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available (-6 / +1 lines)
 Lines 28-34   def copy_package_to_appcenter(ucs_version, app_directory, package_name): Link Here 
28
	''' % {'version': ucs_version, 'app': app_directory}, shell=True)
28
	''' % {'version': ucs_version, 'app': app_directory}, shell=True)
29
29
30
if __name__ == '__main__':
30
if __name__ == '__main__':
31
	
32
	with Appcenter() as appcenter:
31
	with Appcenter() as appcenter:
33
32
34
		ucr = ConfigRegistry()
33
		ucr = ConfigRegistry()
 Lines 36-42   if __name__ == '__main__': Link Here 
36
35
37
		app_name = get_app_name()
36
		app_name = get_app_name()
38
		package_name = get_app_name()
37
		package_name = get_app_name()
39
		
38
40
		app = App(name=app_name, version='1', package_name=package_name)
39
		app = App(name=app_name, version='1', package_name=package_name)
41
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0')
40
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0')
42
41
 Lines 47-55   if __name__ == '__main__': Link Here 
47
		test_package_v1.build()
46
		test_package_v1.build()
48
		copy_package_to_appcenter(ucr['version/version'], app.app_directory, test_package_v1.get_binary_name())
47
		copy_package_to_appcenter(ucr['version/version'], app.app_directory, test_package_v1.get_binary_name())
49
48
50
51
		try:
49
		try:
52
53
			appcenter.update()
50
			appcenter.update()
54
51
55
			app.install()
52
			app.install()
 Lines 78-85   if __name__ == '__main__': Link Here 
78
			res = app.execute_command_in_container('/usr/share/univention-docker-container-mode/update_available')
75
			res = app.execute_command_in_container('/usr/share/univention-docker-container-mode/update_available')
79
			if res != 'release: 4.1-0\n':
76
			if res != 'release: 4.1-0\n':
80
				fail('update_available returned [%s] instead of [release: 4.1-0\n]' % res)
77
				fail('update_available returned [%s] instead of [release: 4.1-0\n]' % res)
81
82
		finally:
78
		finally:
83
			app.uninstall()
79
			app.uninstall()
84
			app.remove()
80
			app.remove()
85
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade (-5 lines)
 Lines 11-17   from univention.config_registry import ConfigRegistry Link Here 
11
11
12
12
13
if __name__ == '__main__':
13
if __name__ == '__main__':
14
	
15
	with Appcenter() as appcenter:
14
	with Appcenter() as appcenter:
16
		appcenter.add_ucs_version_to_appcenter('4.0')
15
		appcenter.add_ucs_version_to_appcenter('4.0')
17
16
 Lines 24-30   if __name__ == '__main__': Link Here 
24
		app.add_to_local_appcenter()
23
		app.add_to_local_appcenter()
25
		app_directory_suffix = app.app_directory_suffix
24
		app_directory_suffix = app.app_directory_suffix
26
25
27
		
28
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
26
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
29
		app = App(name=app_name, version='1', package_name=package_name, build_package=False)
27
		app = App(name=app_name, version='1', package_name=package_name, build_package=False)
30
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
28
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
 Lines 41-47   if __name__ == '__main__': Link Here 
41
		app.add_to_local_appcenter()
39
		app.add_to_local_appcenter()
42
40
43
		try:
41
		try:
44
45
			appcenter.update()
42
			appcenter.update()
46
43
47
			app.install()
44
			app.install()
 Lines 111-118   if __name__ == '__main__': Link Here 
111
				fail('UCR variable test1 differes')
108
				fail('UCR variable test1 differes')
112
			if test_secret != test_secret_new:
109
			if test_secret != test_secret_new:
113
				fail('/etc/test.secret link has been changed')
110
				fail('/etc/test.secret link has been changed')
114
115
		finally:
111
		finally:
116
			app.uninstall()
112
			app.uninstall()
117
			app.remove()
113
			app.remove()
118
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/65_app_container_upgrade_dockerallowedimage (-5 lines)
 Lines 13-19   from univention.config_registry import ConfigRegistry Link Here 
13
13
14
14
15
if __name__ == '__main__':
15
if __name__ == '__main__':
16
	
17
	with Appcenter() as appcenter:
16
	with Appcenter() as appcenter:
18
		appcenter.add_ucs_version_to_appcenter('4.0')
17
		appcenter.add_ucs_version_to_appcenter('4.0')
19
18
 Lines 26-32   if __name__ == '__main__': Link Here 
26
		app.add_to_local_appcenter()
25
		app.add_to_local_appcenter()
27
		app_directory_suffix = app.app_directory_suffix
26
		app_directory_suffix = app.app_directory_suffix
28
27
29
		
30
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
28
		# Since we are installing on a 4.1, a 4.1 ini entry is needed
31
		app = App(name=app_name, version='1', package_name=package_name, build_package=False)
29
		app = App(name=app_name, version='1', package_name=package_name, build_package=False)
32
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
30
		app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.0-3',
 Lines 41-47   if __name__ == '__main__': Link Here 
41
		app.add_to_local_appcenter()
39
		app.add_to_local_appcenter()
42
40
43
		try:
41
		try:
44
45
			appcenter.update()
42
			appcenter.update()
46
43
47
			app.install()
44
			app.install()
 Lines 84-91   if __name__ == '__main__': Link Here 
84
			print 'Container UUID: %s' % container_uuid_new
81
			print 'Container UUID: %s' % container_uuid_new
85
			if container_uuid != container_uuid_new:
82
			if container_uuid != container_uuid_new:
86
				fail('The container UUID has been changed.')
83
				fail('The container UUID has been changed.')
87
88
		finally:
84
		finally:
89
			app.uninstall()
85
			app.uninstall()
90
			app.remove()
86
			app.remove()
91
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling (-9 / +5 lines)
 Lines 8-22    Link Here 
8
8
9
from dockertest import *
9
from dockertest import *
10
10
11
DOCKER_APP_COUNT=20
11
DOCKER_APP_COUNT = 20
12
12
13
if __name__ == '__main__':
13
if __name__ == '__main__':
14
	
15
	with Appcenter() as appcenter:
14
	with Appcenter() as appcenter:
16
		apps = []
15
		apps = []
17
16
18
		try:
17
		try:
19
			for i in range(0,DOCKER_APP_COUNT):
18
			for i in range(0, DOCKER_APP_COUNT):
20
				app = App(name=get_app_name(), version=get_app_version())
19
				app = App(name=get_app_name(), version=get_app_version())
21
				app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0',
20
				app.set_ini_parameter(DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0',
22
									WebInterface='/%s' % app.app_name,
21
									WebInterface='/%s' % app.app_name,
 Lines 30-47   if __name__ == '__main__': Link Here 
30
29
31
				apps.append(app)
30
				apps.append(app)
32
31
33
34
			appcenter.update()
32
			appcenter.update()
35
33
36
			for i in range(0,DOCKER_APP_COUNT):
34
			for i in range(0, DOCKER_APP_COUNT):
37
				apps[i].install()
35
				apps[i].install()
38
36
39
			for i in range(0,DOCKER_APP_COUNT):
37
			for i in range(0, DOCKER_APP_COUNT):
40
				apps[i].verify()
38
				apps[i].verify()
41
				apps[i].verify_basic_modproxy_settings()
39
				apps[i].verify_basic_modproxy_settings()
42
43
		finally:
40
		finally:
44
			for i in range(0,len(apps)):
41
			for i in range(0, len(apps)):
45
				apps[i].uninstall()
42
				apps[i].uninstall()
46
				apps[i].remove()
43
				apps[i].remove()
47
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive (-4 / +2 lines)
 Lines 14-22   import pytest Link Here 
14
import socket
14
import socket
15
15
16
if __name__ == '__main__':
16
if __name__ == '__main__':
17
	
18
	with Appcenter() as appcenter:
17
	with Appcenter() as appcenter:
19
20
		app_name = get_app_name()
18
		app_name = get_app_name()
21
		app_version = get_app_version()
19
		app_version = get_app_version()
22
		app = App(name=app_name, version=app_version, build_package=False)
20
		app = App(name=app_name, version=app_version, build_package=False)
 Lines 43-49   if __name__ == '__main__': Link Here 
43
				univention-app register "%(app_name)s" --component
41
				univention-app register "%(app_name)s" --component
44
				app_packages="$(univention-app get "%(app_name)s" default_packages --values-only --shell)"
42
				app_packages="$(univention-app get "%(app_name)s" default_packages --values-only --shell)"
45
				univention-install -y $app_packages
43
				univention-install -y $app_packages
46
				''' % {'app_name': app_name})	
44
				''' % {'app_name': app_name})
47
			app.add_to_local_appcenter()
45
			app.add_to_local_appcenter()
48
			appcenter.update()
46
			appcenter.update()
49
			app.install()
47
			app.install()
 Lines 54-60   if __name__ == '__main__': Link Here 
54
52
55
			# restart firewall and check again
53
			# restart firewall and check again
56
			restart_firewall()
54
			restart_firewall()
57
			
55
58
			# check ports are open
56
			# check ports are open
59
			for port in ports:
57
			for port in ports:
60
				is_port_open(port)
58
				is_port_open(port)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect (-4 / +2 lines)
 Lines 14-22   import pytest Link Here 
14
import socket
14
import socket
15
15
16
if __name__ == '__main__':
16
if __name__ == '__main__':
17
	
18
	with Appcenter() as appcenter:
17
	with Appcenter() as appcenter:
19
20
		app_name = get_app_name()
18
		app_name = get_app_name()
21
		app_version = get_app_version()
19
		app_version = get_app_version()
22
		app = App(name=app_name, version=app_version, build_package=False)
20
		app = App(name=app_name, version=app_version, build_package=False)
 Lines 44-50   if __name__ == '__main__': Link Here 
44
				univention-app register "%(app_name)s" --component
42
				univention-app register "%(app_name)s" --component
45
				app_packages="$(univention-app get "%(app_name)s" default_packages --values-only --shell)"
43
				app_packages="$(univention-app get "%(app_name)s" default_packages --values-only --shell)"
46
				univention-install -y $app_packages
44
				univention-install -y $app_packages
47
				''' % {'app_name': app_name})	
45
				''' % {'app_name': app_name})
48
			app.add_to_local_appcenter()
46
			app.add_to_local_appcenter()
49
			appcenter.update()
47
			appcenter.update()
50
			app.install()
48
			app.install()
 Lines 56-62   if __name__ == '__main__': Link Here 
56
54
57
			# restart firewall and check again
55
			# restart firewall and check again
58
			restart_firewall()
56
			restart_firewall()
59
			
57
60
			# check ports are open
58
			# check ports are open
61
			for port in ports:
59
			for port in ports:
62
				host_port, container_port = port.split(':')
60
				host_port, container_port = port.split(':')
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive (-2 lines)
 Lines 14-22   import pytest Link Here 
14
import time
14
import time
15
15
16
if __name__ == '__main__':
16
if __name__ == '__main__':
17
	
18
	with Appcenter() as appcenter:
17
	with Appcenter() as appcenter:
19
20
		version = get_app_version()
18
		version = get_app_version()
21
		image = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
19
		image = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
22
20
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect (-2 lines)
 Lines 14-22   import pytest Link Here 
14
import time
14
import time
15
15
16
if __name__ == '__main__':
16
if __name__ == '__main__':
17
	
18
	with Appcenter() as appcenter:
17
	with Appcenter() as appcenter:
19
20
		version = get_app_version()
18
		version = get_app_version()
21
		image = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
19
		image = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
22
20
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/79_app_ports_already_used (-8 / +7 lines)
 Lines 13-19   import sys Link Here 
13
def _open_port(port):
13
def _open_port(port):
14
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
14
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
15
	try:
15
	try:
16
    		s.bind(('', port))
16
		s.bind(('', port))
17
	except socket.error as msg:
17
	except socket.error as msg:
18
		print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
18
		print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
19
		return None
19
		return None
 Lines 23-39   def _open_port(port): Link Here 
23
23
24
24
25
if __name__ == '__main__':
25
if __name__ == '__main__':
26
	
27
	sockets = []
26
	sockets = []
28
	for i in range(40000,40100):
27
	for i in range(40000, 40100):
29
		sockets.append(_open_port(i))
28
		sockets.append(_open_port(i))
30
29
31
	with Appcenter() as appcenter:
30
	with Appcenter() as appcenter:
32
		app_name = get_app_name()
31
		app_name = get_app_name()
33
		app_version = get_app_version()
32
		app_version = get_app_version()
34
	
33
35
		app = App(name=app_name, version=app_version)
34
		app = App(name=app_name, version=app_version)
36
	
35
37
		try:
36
		try:
38
			app.set_ini_parameter(	DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0',
37
			app.set_ini_parameter(	DockerImage='docker.software-univention.de/ucs-appbox-amd64:4.1-0',
39
									WebInterface='/%s' % app.app_name,
38
									WebInterface='/%s' % app.app_name,
 Lines 44-54   if __name__ == '__main__': Link Here 
44
								)
43
								)
45
			app.create_basic_modproxy_settings()
44
			app.create_basic_modproxy_settings()
46
			app.add_to_local_appcenter()
45
			app.add_to_local_appcenter()
47
	
46
48
			appcenter.update()
47
			appcenter.update()
49
	
48
50
			app.install()
49
			app.install()
51
	
50
52
			app.verify()
51
			app.verify()
53
52
54
			app.verify_basic_modproxy_settings()
53
			app.verify_basic_modproxy_settings()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/80_docker_pull_via_proxy_http (-2 / +5 lines)
 Lines 13-18   from univention.testing.utils import fail Link Here 
13
from dockertest import docker_login, pull_docker_image, docker_image_is_present
13
from dockertest import docker_login, pull_docker_image, docker_image_is_present
14
from dockertest import remove_docker_image, restart_docker
14
from dockertest import remove_docker_image, restart_docker
15
15
16
16
def deb_package_is_installed(pkgname):
17
def deb_package_is_installed(pkgname):
17
	cache = apt.Cache()
18
	cache = apt.Cache()
18
	if cache[pkgname].is_installed:
19
	if cache[pkgname].is_installed:
 Lines 20-30   def deb_package_is_installed(pkgname): Link Here 
20
	else:
21
	else:
21
		return False
22
		return False
22
23
24
23
def deb_install_package(pkgname):
25
def deb_install_package(pkgname):
24
	cmd = ['univention-install', '-y', pkgname]
26
	cmd = ['univention-install', '-y', pkgname]
25
	p = subprocess.Popen(cmd, close_fds=True)
27
	p = subprocess.Popen(cmd, close_fds=True)
26
	p.wait()
28
	p.wait()
27
29
30
28
def deb_uninstall_package(pkgname):
31
def deb_uninstall_package(pkgname):
29
	cmd = ['apt-get', 'purge', '-y', pkgname]
32
	cmd = ['apt-get', 'purge', '-y', pkgname]
30
	p = subprocess.Popen(cmd, close_fds=True)
33
	p = subprocess.Popen(cmd, close_fds=True)
 Lines 34-39   def deb_uninstall_package(pkgname): Link Here 
34
	p = subprocess.Popen(cmd, close_fds=True)
37
	p = subprocess.Popen(cmd, close_fds=True)
35
	p.wait()
38
	p.wait()
36
39
40
37
class TestCase:
41
class TestCase:
38
	def __init__(self):
42
	def __init__(self):
39
		self.ucr = UCSTestConfigRegistry()
43
		self.ucr = UCSTestConfigRegistry()
 Lines 41-47   class TestCase: Link Here 
41
45
42
		self.imgname = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
46
		self.imgname = 'docker.software-univention.de/ucs-appbox-amd64:4.1-0'
43
47
44
                required_pkgname = 'univention-squid'
48
		required_pkgname = 'univention-squid'
45
		if not deb_package_is_installed(required_pkgname):
49
		if not deb_package_is_installed(required_pkgname):
46
			deb_install_package(required_pkgname)
50
			deb_install_package(required_pkgname)
47
			self.remove_pkgname = required_pkgname
51
			self.remove_pkgname = required_pkgname
 Lines 82-87   class TestCase: Link Here 
82
86
83
87
84
if __name__ == '__main__':
88
if __name__ == '__main__':
85
	
86
	with TestCase() as tc:
89
	with TestCase() as tc:
87
		tc.run()
90
		tc.run()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/create_appcenter_json.py (-16 / +28 lines)
 Lines 50-55   DOCKER_READ_USER_CRED = { Link Here 
50
	'password': 'readonly',
50
	'password': 'readonly',
51
	}
51
	}
52
52
53
53
class FileInfo(object):
54
class FileInfo(object):
54
	def __init__(self, app, name, url, filename):
55
	def __init__(self, app, name, url, filename):
55
		self.name = name
56
		self.name = name
 Lines 59-70   class FileInfo(object): Link Here 
59
		self.sha256 = sha256sum(filename)
60
		self.sha256 = sha256sum(filename)
60
		self.archive_filename = '%s.%s' % (app.name, name)
61
		self.archive_filename = '%s.%s' % (app.name, name)
61
62
63
62
class DockerImageInfo(object):
64
class DockerImageInfo(object):
63
	def __init__(self, name, url, content):
65
	def __init__(self, name, url, content):
64
		self.name = name
66
		self.name = name
65
		self.url = url
67
		self.url = url
66
		self.sha256 = sha256(content).hexdigest()
68
		self.sha256 = sha256(content).hexdigest()
67
69
70
68
class App(object):
71
class App(object):
69
	def __init__(self, name, ucs_version, meta_inf_dir, components_dir, server):
72
	def __init__(self, name, ucs_version, meta_inf_dir, components_dir, server):
70
		self.name = name
73
		self.name = name
 Lines 198-204   class App(object): Link Here 
198
		index = {}
201
		index = {}
199
		for file_info in self.important_files():
202
		for file_info in self.important_files():
200
			index[file_info.name] = {
203
			index[file_info.name] = {
201
				'url' : file_info.url,
204
				'url': file_info.url,
202
				}
205
				}
203
			for hash_type in ('md5', 'sha256'):
206
			for hash_type in ('md5', 'sha256'):
204
				try:
207
				try:
 Lines 208-249   class App(object): Link Here 
208
					pass
211
					pass
209
		for docker_image_info in self.docker_images():
212
		for docker_image_info in self.docker_images():
210
			index['ini'][docker_image_info.name] = {
213
			index['ini'][docker_image_info.name] = {
211
				'url' : docker_image_info.url,
214
				'url': docker_image_info.url,
212
				'sha256' : docker_image_info.sha256,
215
				'sha256': docker_image_info.sha256,
213
				}
216
				}
214
		return index
217
		return index
215
218
219
216
def check_ini_file(filename):
220
def check_ini_file(filename):
217
	name, ext = os.path.splitext(os.path.basename(filename))
221
	name, ext = os.path.splitext(os.path.basename(filename))
218
	if ext == '.ini':
222
	if ext == '.ini':
219
		return name
223
		return name
220
224
225
221
def md5sum(filename):
226
def md5sum(filename):
222
	m = md5()
227
	m = md5()
223
	with open(filename, 'r') as f:
228
	with open(filename, 'r') as f:
224
		m.update(f.read())
229
		m.update(f.read())
225
		return m.hexdigest()
230
		return m.hexdigest()
226
231
232
227
def sha256sum(filename):
233
def sha256sum(filename):
228
	m = sha256()
234
	m = sha256()
229
	with open(filename, 'r') as f:
235
	with open(filename, 'r') as f:
230
		m.update(f.read())
236
		m.update(f.read())
231
		return m.hexdigest()
237
		return m.hexdigest()
232
238
239
233
if __name__ == '__main__':
240
if __name__ == '__main__':
234
	parser = OptionParser()
241
	parser = OptionParser()
235
	parser.add_option("-u", "--ucs-version", dest="version", default="3.1",
242
	parser.add_option(
236
			help="use UCS version VERSION (e.g. (and default) %default)", metavar="VERSION")
243
		"-u", "--ucs-version", dest="version", default="3.1",
237
	parser.add_option("-d", "--directory", dest="directory", default=".",
244
		help="use UCS version VERSION (e.g. (and default) %default)", metavar="VERSION")
238
			help="root directory where meta-inf and univention-repository lie", metavar="DIR")
245
	parser.add_option(
239
	parser.add_option("-o", "--output", dest="output", default=None,
246
		"-d", "--directory", dest="directory", default=".",
240
			help="write output to OUTPUTFILE. Defaults to stdout. If specified and not ending with .gz, .gz is added", metavar="OUTPUTFILE")
247
		help="root directory where meta-inf and univention-repository lie", metavar="DIR")
241
	parser.add_option("-t", "--tar", dest="archive", default=None,
248
	parser.add_option(
242
			help="additionally add all files to tar archive TARFILE (not compressed)", metavar="TARFILE")
249
		"-o", "--output", dest="output", default=None,
243
	parser.add_option("-a", "--ask", action="store_true", dest="ask", default=False,
250
		help="write output to OUTPUTFILE. Defaults to stdout. If specified and not ending with .gz, .gz is added", metavar="OUTPUTFILE")
244
			help="Diff between existing OUTPUTFILE and buffer. Overwrites if changes are confirmed (interactive! ... if any diff)")
251
	parser.add_option(
245
	parser.add_option("-s", "--server", dest="appcenter", default="https://appcenter.software-univention.de/",
252
		"-t", "--tar", dest="archive", default=None,
246
			help="external Univention App Center Server (defaults to %default. Another possibility may be https://appcenter-test.software-univention.de/ or http://appcenter.knut.univention.de/)", metavar="APPCENTER")
253
		help="additionally add all files to tar archive TARFILE (not compressed)", metavar="TARFILE")
254
	parser.add_option(
255
		"-a", "--ask", action="store_true", dest="ask", default=False,
256
		help="Diff between existing OUTPUTFILE and buffer. Overwrites if changes are confirmed (interactive! ... if any diff)")
257
	parser.add_option(
258
		"-s", "--server", dest="appcenter", default="https://appcenter.software-univention.de/",
259
		help="external Univention App Center Server (defaults to %default. Another possibility may be https://appcenter-test.software-univention.de/ or http://appcenter.knut.univention.de/)", metavar="APPCENTER")
247
260
248
	(options, args) = parser.parse_args()
261
	(options, args) = parser.parse_args()
249
	root = options.directory
262
	root = options.directory
 Lines 294-297   if __name__ == '__main__': Link Here 
294
			f.close()
307
			f.close()
295
	else:
308
	else:
296
		print out
309
		print out
297
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-15 / +50 lines)
 Lines 39-55   import subprocess Link Here 
39
import urllib2
39
import urllib2
40
40
41
41
42
class UCSTest_Docker_Exception(Exception): pass
42
43
class UCSTest_Docker_LoginFailed(Exception): pass
43
class UCSTest_Docker_Exception(Exception):
44
class UCSTest_Docker_PullFailed(Exception): pass
44
	pass
45
class AppcenterMetainfAlreadyExists(Exception): pass
45
46
class AppcenterRepositoryAlreadyExists(Exception): pass
46
47
class UCSTest_DockerApp_InstallationFailed(Exception): pass
47
class UCSTest_Docker_LoginFailed(Exception):
48
class UCSTest_DockerApp_UpdateFailed(Exception): pass
48
	pass
49
class UCSTest_DockerApp_UpgradeFailed(Exception): pass
49
50
class UCSTest_DockerApp_VerifyFailed(Exception): pass
50
51
class UCSTest_DockerApp_RemoveFailed(Exception): pass
51
class UCSTest_Docker_PullFailed(Exception):
52
class UCSTest_DockerApp_ModProxyFailed(Exception): pass
52
	pass
53
54
55
class AppcenterMetainfAlreadyExists(Exception):
56
	pass
57
58
59
class AppcenterRepositoryAlreadyExists(Exception):
60
	pass
61
62
63
class UCSTest_DockerApp_InstallationFailed(Exception):
64
	pass
65
66
67
class UCSTest_DockerApp_UpdateFailed(Exception):
68
	pass
69
70
71
class UCSTest_DockerApp_UpgradeFailed(Exception):
72
	pass
73
74
75
class UCSTest_DockerApp_VerifyFailed(Exception):
76
	pass
77
78
79
class UCSTest_DockerApp_RemoveFailed(Exception):
80
	pass
81
82
83
class UCSTest_DockerApp_ModProxyFailed(Exception):
84
	pass
53
85
54
86
55
def docker_login(server='docker.software-univention.de'):
87
def docker_login(server='docker.software-univention.de'):
 Lines 63-68   def docker_pull(image, server='docker.software-univention.de'): Link Here 
63
	if ret != 0:
95
	if ret != 0:
64
		raise UCSTest_Docker_PullFailed()
96
		raise UCSTest_Docker_PullFailed()
65
97
98
66
def docker_image_is_present(imgname):
99
def docker_image_is_present(imgname):
67
	cmd = ['docker', 'inspect', imgname]
100
	cmd = ['docker', 'inspect', imgname]
68
	with open('/dev/null', 'w') as devnull:
101
	with open('/dev/null', 'w') as devnull:
 Lines 70-93   def docker_image_is_present(imgname): Link Here 
70
		p.wait()
103
		p.wait()
71
		return p.returncode == 0
104
		return p.returncode == 0
72
105
106
73
def remove_docker_image(imgname):
107
def remove_docker_image(imgname):
74
	cmd = ['docker', 'rmi', imgname]
108
	cmd = ['docker', 'rmi', imgname]
75
	p = subprocess.Popen(cmd, close_fds=True)
109
	p = subprocess.Popen(cmd, close_fds=True)
76
	p.wait()
110
	p.wait()
77
	return p.returncode == 0
111
	return p.returncode == 0
78
112
113
79
def pull_docker_image(imgname):
114
def pull_docker_image(imgname):
80
	cmd = ['docker', 'pull', imgname]
115
	cmd = ['docker', 'pull', imgname]
81
	p = subprocess.Popen(cmd, close_fds=True)
116
	p = subprocess.Popen(cmd, close_fds=True)
82
	p.wait()
117
	p.wait()
83
	return p.returncode == 0
118
	return p.returncode == 0
84
119
120
85
def restart_docker():
121
def restart_docker():
86
	cmd = ['invoke-rc.d', 'docker', 'restart']
122
	cmd = ['invoke-rc.d', 'docker', 'restart']
87
	p = subprocess.Popen(cmd, close_fds=True)
123
	p = subprocess.Popen(cmd, close_fds=True)
88
	p.wait()
124
	p.wait()
89
	return p.returncode == 0
125
	return p.returncode == 0
90
126
127
91
def get_app_name():
128
def get_app_name():
92
	""" returns a valid app name """
129
	""" returns a valid app name """
93
	return random_name()
130
	return random_name()
 Lines 114-120   class App: Link Here 
114
		else:
151
		else:
115
			self.package_name = get_app_name()
152
			self.package_name = get_app_name()
116
153
117
		self.package_version = '%s.%s' % (version,get_app_version())
154
		self.package_version = '%s.%s' % (version, get_app_version())
118
155
119
		self.ucr = ConfigRegistry()
156
		self.ucr = ConfigRegistry()
120
		self.ucr.load()
157
		self.ucr.load()
 Lines 288-295   echo "TEST-%(app_name)s" >>/var/www/%(app_name)s/index.txt Link Here 
288
			raise UCSTest_DockerApp_ModProxyFailed(Exception)
325
			raise UCSTest_DockerApp_ModProxyFailed(Exception)
289
326
290
327
291
292
293
class Appcenter:
328
class Appcenter:
294
	def __init__(self, version=None):
329
	def __init__(self, version=None):
295
		self.meta_inf_created = False
330
		self.meta_inf_created = False
 Lines 311-317   class Appcenter: Link Here 
311
		self.add_ucs_version_to_appcenter(version)
346
		self.add_ucs_version_to_appcenter(version)
312
347
313
	def add_ucs_version_to_appcenter(self, version):
348
	def add_ucs_version_to_appcenter(self, version):
314
315
		if not os.path.exists('/var/www/meta-inf'):
349
		if not os.path.exists('/var/www/meta-inf'):
316
			os.makedirs('/var/www/meta-inf', 0755)
350
			os.makedirs('/var/www/meta-inf', 0755)
317
			self.meta_inf_created = True
351
			self.meta_inf_created = True
 Lines 368-373   Virtualization=Virtualisierung''') Link Here 
368
			print 'Cleanup after exception: %s %s' % (exc_type, exc_value)
402
			print 'Cleanup after exception: %s %s' % (exc_type, exc_value)
369
		self.cleanup()
403
		self.cleanup()
370
404
405
371
def restore_data_script_4_1():
406
def restore_data_script_4_1():
372
	return '''#!/usr/bin/python2.7
407
	return '''#!/usr/bin/python2.7
373
from optparse import OptionParser
408
from optparse import OptionParser
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/univention/testing/debian_package.py (-3 / +1 lines)
 Lines 185-190   uninstall/* usr/lib/univention-uninstall/ Link Here 
185
'''
185
'''
186
		self.create_debian_file_from_buffer('install', install)
186
		self.create_debian_file_from_buffer('install', install)
187
187
188
188
if __name__ == '__main__':
189
if __name__ == '__main__':
189
	deb = DebianPackage('testdeb')
190
	deb = DebianPackage('testdeb')
190
	share_file = '''# testdeb
191
	share_file = '''# testdeb
 Lines 197-200   if __name__ == '__main__': Link Here 
197
	deb.install()
198
	deb.install()
198
	deb.uninstall()
199
	deb.uninstall()
199
	deb.remove()
200
	deb.remove()
200
201
- 
202
--
203
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/debian/control                 | 2 ++
201
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/debian/control                 | 2 ++
204
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini | 2 --
202
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini | 2 --
205
.../ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3        | 2 --
203
.../ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3        | 2 --
206
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install | 2 --
204
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install | 2 --
207
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 --
205
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 --
208
.../ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage      | 2 --
206
.../ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage      | 2 --
209
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst | 2 --
207
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst | 2 --
210
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy     | 2 --
208
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy     | 2 --
211
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop    | 2 --
209
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop    | 2 --
212
.../ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package      | 2 --
210
.../ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package      | 2 --
213
.../ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation       | 2 --
211
.../ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation       | 2 --
214
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature     | 2 --
212
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature     | 2 --
215
.../ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify     | 2 --
213
.../ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify     | 2 --
216
.../ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available     | 2 --
214
.../ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available     | 2 --
217
.../ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade    | 2 --
215
.../ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade    | 2 --
218
.../tests/80_docker/65_app_container_upgrade_dockerallowedimage         | 2 --
216
.../tests/80_docker/65_app_container_upgrade_dockerallowedimage         | 2 --
219
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling | 2 --
217
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling | 2 --
220
.../ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive      | 2 --
218
.../ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive      | 2 --
221
.../ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect       | 2 --
219
.../ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect       | 2 --
222
.../test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive      | 2 --
220
.../test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive      | 2 --
223
.../test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect       | 2 --
221
.../test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect       | 2 --
224
.../ucs-4.1-0/test/ucs-test/tests/80_docker/79_app_ports_already_used   | 2 --
222
.../ucs-4.1-0/test/ucs-test/tests/80_docker/79_app_ports_already_used   | 2 --
225
22 files changed, 2 insertions(+), 42 deletions(-)
223
22 files changed, 2 insertions(+), 42 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/debian/control (+2 lines)
 Lines 523-528   Architecture: all Link Here 
523
Depends: ucs-test-libs (= ${source:Version}),
523
Depends: ucs-test-libs (= ${source:Version}),
524
 ${misc:Depends},
524
 ${misc:Depends},
525
 python-pytest,
525
 python-pytest,
526
 docker.io,
527
 build-essential,
526
Recommends: ucs-test-framework
528
Recommends: ucs-test-framework
527
Provides: ucs-test-module
529
Provides: ucs-test-module
528
Description: Test scripts to test the Docker integration
530
Description: Test scripts to test the Docker integration
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Pull appbox docker image
2
## desc: Pull appbox docker image
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
7
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3 (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple UCS 4.0-3 docker app
2
## desc: Create and install a simple UCS 4.0-3 docker app
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app
2
## desc: Create and install a simple docker app
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple DC Slave docker app
2
## desc: Create and install a simple DC Slave docker app
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
## versions:
5
## versions:
8
##  4.1-0: skip
6
##  4.1-0: skip
9
## bugs:
7
## bugs:
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app without the DockerImage parameter
2
## desc: Create and install a simple docker app without the DockerImage parameter
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import fail
7
from univention.testing.utils import fail
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Check the preinst script
2
## desc: Check the preinst script
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
7
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Check Docker App mod_proxy configuration
2
## desc: Check Docker App mod_proxy configuration
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
7
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Check if a nscd stop also kills the container nscd processes
2
## desc: Check if a nscd stop also kills the container nscd processes
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
import subprocess
7
import subprocess
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app without a Debian package (plain container app)
2
## desc: Create and install a simple docker app without a Debian package (plain container app)
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Test the Docker App uninstallation
2
## desc: Test the Docker App uninstallation
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import fail, get_ldap_connection
7
from univention.testing.utils import fail, get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Verify the signature implementation
2
## desc: Verify the signature implementation
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
import os
6
import os
9
from dockertest import *
7
from dockertest import *
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Check updater/identify in a new Docker App
2
## desc: Check updater/identify in a new Docker App
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
7
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available (-2 lines)
 Lines 4-11    Link Here 
4
## exposure: dangerous
4
## exposure: dangerous
5
## versions:
5
## versions:
6
##  4.1-0: skip
6
##  4.1-0: skip
7
## packages:
8
##   - docker.io
9
7
10
from dockertest import *
8
from dockertest import *
11
from univention.testing.debian_package import DebianPackage
9
from univention.testing.debian_package import DebianPackage
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Test the container upgrade without a re-join
2
## desc: Test the container upgrade without a re-join
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection, fail
7
from univention.testing.utils import get_ldap_connection, fail
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/65_app_container_upgrade_dockerallowedimage (-2 lines)
 Lines 4-11    Link Here 
4
## exposure: dangerous
4
## exposure: dangerous
5
## versions:
5
## versions:
6
##  4.1-0: skip
6
##  4.1-0: skip
7
## packages:
8
##   - docker.io
9
7
10
from dockertest import *
8
from dockertest import *
11
from univention.testing.utils import get_ldap_connection,fail
9
from univention.testing.utils import get_ldap_connection,fail
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling (-2 lines)
 Lines 3-10    Link Here 
3
## tags: [WIP,docker]
3
## tags: [WIP,docker]
4
## timeout: 7200
4
## timeout: 7200
5
## exposure: dangerous
5
## exposure: dangerous
6
## packages:
7
##   - docker.io
8
6
9
from dockertest import *
7
from dockertest import *
10
8
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app and check ports exclusive
2
## desc: Create and install a simple docker app and check ports exclusive
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app and check ports redirect
2
## desc: Create and install a simple docker app and check ports redirect
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app and check ports exclusive constraints
2
## desc: Create and install a simple docker app and check ports exclusive constraints
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect (-2 lines)
 Lines 2-9    Link Here 
2
## desc: Create and install a simple docker app and check ports redirection constraints
2
## desc: Create and install a simple docker app and check ports redirection constraints
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/79_app_ports_already_used (-4 lines)
 Lines 2-9    Link Here 
2
## desc: Check the App installation if the next free port is already used
2
## desc: Check the App installation if the next free port is already used
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
## packages:
6
##   - docker.io
7
5
8
from dockertest import *
6
from dockertest import *
9
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
10
- 
11
--
12
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py | 1 -
8
branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py | 1 -
13
1 file changed, 1 deletion(-)
9
1 file changed, 1 deletion(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-3 lines)
 Lines 187-193   class App: Link Here 
187
	def set_ini_parameter(self, **kwargs):
187
	def set_ini_parameter(self, **kwargs):
188
		for key, value in kwargs.iteritems():
188
		for key, value in kwargs.iteritems():
189
			self.ini[key] = value
189
			self.ini[key] = value
190
		pass
191
190
192
	def add_to_local_appcenter(self):
191
	def add_to_local_appcenter(self):
193
		self._dump_ini()
192
		self._dump_ini()
194
- 
195
--
196
.../test/ucs-test/tests/80_docker/categories.ini   |   8 +
193
.../test/ucs-test/tests/80_docker/categories.ini   |   8 +
197
.../test/ucs-test/tests/80_docker/dockertest.py    | 252 +--------------------
194
.../test/ucs-test/tests/80_docker/dockertest.py    | 252 +--------------------
198
.../test/ucs-test/tests/80_docker/dummy.svg        |  40 ++++
195
.../test/ucs-test/tests/80_docker/dummy.svg        |  40 ++++
199
.../tests/80_docker/restore_data_script_4_1.py     |  98 ++++++++
196
.../tests/80_docker/restore_data_script_4_1.py     |  98 ++++++++
200
.../test/ucs-test/tests/80_docker/setup.sh         |  11 +
197
.../test/ucs-test/tests/80_docker/setup.sh         |  11 +
201
.../tests/80_docker/store_data_script_4_1.py       |  91 ++++++++
198
.../tests/80_docker/store_data_script_4_1.py       |  91 ++++++++
202
6 files changed, 257 insertions(+), 243 deletions(-)
199
6 files changed, 257 insertions(+), 243 deletions(-)
203
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/categories.ini
200
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/categories.ini
204
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dummy.svg
201
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dummy.svg
205
create mode 100755 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/restore_data_script_4_1.py
202
create mode 100755 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/restore_data_script_4_1.py
206
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/setup.sh
203
create mode 100644 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/setup.sh
207
create mode 100755 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/store_data_script_4_1.py
204
create mode 100755 branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/store_data_script_4_1.py
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/categories.ini (+8 lines)
Line 0    Link Here 
1
[de]
2
Administration=Administration
3
Business=Business
4
Collaboration=Collaboration
5
Education=Schule
6
System services=Systemdienste
7
UCS components=UCS-Komponenten
8
Virtualization=Virtualisierung
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-243 / +9 lines)
 Lines 297-313   class App: Link Here 
297
		''' % {'version': self.ucs_version, 'app': self.app_directory}, shell=True)
297
		''' % {'version': self.ucs_version, 'app': self.app_directory}, shell=True)
298
298
299
	def create_basic_modproxy_settings(self):
299
	def create_basic_modproxy_settings(self):
300
		self.add_script(setup='''#!/bin/bash
300
		setup = open(os.path.join(os.path.dirname(__file__), 'setup.sh'), 'r').read()
301
set -x -e
301
		self.add_script(setup=setup % {'app_name': self.app_name})
302
eval "$(ucr shell)"
303
if [ "$version_version" = 4.0 ]; then
304
	ucr set repository/online/server="$(echo $repository_online_server | sed -e 's|.*//\(.*\)|\\1|')"
305
fi
306
univention-install --yes univention-apache
307
mkdir /var/www/%(app_name)s
308
echo "TEST-%(app_name)s" >>/var/www/%(app_name)s/index.txt
309
/usr/share/univention-docker-container-mode/setup "$@"
310
''' % {'app_name': self.app_name})
311
302
312
	def verify_basic_modproxy_settings(self):
303
	def verify_basic_modproxy_settings(self):
313
		fqdn = '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
304
		fqdn = '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
 Lines 357-371   class Appcenter: Link Here 
357
		os.makedirs('/var/www/meta-inf/%s' % version)
348
		os.makedirs('/var/www/meta-inf/%s' % version)
358
349
359
		if not os.path.exists('/var/www/meta-inf/categories.ini'):
350
		if not os.path.exists('/var/www/meta-inf/categories.ini'):
351
			text = open(os.path.join(os.path.dirname(__file__), 'categories.ini'), 'r').read()
360
			f = open('/var/www/meta-inf/categories.ini', 'w')
352
			f = open('/var/www/meta-inf/categories.ini', 'w')
361
			f.write('''[de]
353
			f.write(test)
362
Administration=Administration
363
Business=Business
364
Collaboration=Collaboration
365
Education=Schule
366
System services=Systemdienste
367
UCS components=UCS-Komponenten
368
Virtualization=Virtualisierung''')
369
			f.close()
354
			f.close()
370
			f = open('/var/www/meta-inf/rating.ini', 'w')
355
			f = open('/var/www/meta-inf/rating.ini', 'w')
371
			f.write('# rating stuff\n')
356
			f.write('# rating stuff\n')
 Lines 403-633   Virtualization=Virtualisierung''') Link Here 
403
388
404
389
405
def restore_data_script_4_1():
390
def restore_data_script_4_1():
406
	return '''#!/usr/bin/python2.7
391
	return open(os.path.join(os.path.dirname(__file__), 'restore_data_script_4_1.py'), 'r').read()
407
from optparse import OptionParser
392
408
import os
409
import shutil
410
import string
411
import univention.config_registry
412
import traceback
413
414
BLACKLIST_UCR_VARIABLES = [
415
	'version/version',
416
	'version/erratalevel',
417
	'version/patchlevel',
418
	'version/releasename',
419
]
420
421
422
# Helper function to copy all meta data of a file or directory
423
def copy_permissions(src, dest):
424
	s_stat = os.stat(src)
425
	os.chown(dest, s_stat.st_uid, s_stat.st_gid)
426
	shutil.copymode(src, dest)
427
	shutil.copystat(src, dest)
428
	d_stat = os.stat(dest)
429
430
431
def restore_files(source_dir):
432
	if not os.path.exists(source_dir):
433
		return
434
	for (path, dirs, files) in os.walk(source_dir):
435
		for d in dirs:
436
			r_path = string.replace(path, source_dir, '/', 1)
437
			dest = os.path.join(r_path, d)
438
			if not os.path.exists(dest):
439
				os.makedirs(dest)
440
			src = os.path.join(path, d)
441
			copy_permissions(src, dest)
442
		for i in files:
443
			src = os.path.join(path, i)
444
			dest = string.replace(src, source_dir, '', 1)
445
			if os.path.islink(src):
446
				linkto = os.readlink(src)
447
				if os.path.exists(dest) or os.path.islink(dest):
448
					print 'rm %s' % dest
449
					os.remove(dest)
450
				print 'ln -sf %s %s' % (linkto, dest)
451
				os.symlink(linkto, dest)
452
			else:
453
				print 'cp %s %s' % (src, dest)
454
				shutil.copy(src, dest)
455
				copy_permissions(src, dest)
456
457
458
def restore_ucr_layer(ucr_file, options):
459
	if not os.path.exists(ucr_file):
460
		return
461
	f = open(ucr_file, "r")
462
	vv = []
463
	for v in f.readlines():
464
		v = v.strip()
465
		if not v or v.startswith('#'):
466
			continue
467
		key, value = v.split(':', 1)
468
		if key not in BLACKLIST_UCR_VARIABLES:
469
			vv.append('%s=%s' % (key, value))
470
	if vv:
471
		print vv
472
		univention.config_registry.handler_set(vv, opts=options)
473
474
if __name__ == '__main__':
475
	parser = OptionParser('%prog [options]')
476
	parser.add_option('--app', dest='app', help='App ID')
477
	parser.add_option('--app-version', dest='app_version', help='Version of App')
478
	parser.add_option('--error-file', dest='error_file', help='Name of Error File')
479
	opts, args = parser.parse_args()
480
481
	conf_dir = '/var/lib/univention-appcenter/apps/%s/conf/' % opts.app
482
	source_dir = '/var/lib/univention-appcenter/apps/%s/conf/files' % opts.app
483
484
	try:
485
		restore_files(source_dir)
486
487
		print '** Restore forced UCR layer:'
488
		restore_ucr_layer(os.path.join(conf_dir, 'base-forced.conf'), {'force': True})
489
		print '** Restore ldap UCR layer'
490
		restore_ucr_layer(os.path.join(conf_dir, 'base-ldap.conf'), {'ldap-policy': True})
491
		print '** Restore normal UCR layer:'
492
		restore_ucr_layer(os.path.join(conf_dir, 'base.conf'), {})
493
	except:
494
		traceback.print_exc()
495
		if opts.error_file:
496
			error_file = open(opts.error_file, 'a+')
497
			traceback.print_exc(file=error_file)
498
			error_file.close()
499
		raise
500
'''
501
393
502
def store_data_script_4_1():
394
def store_data_script_4_1():
503
	return '''#!/usr/bin/python2.7
395
	return open(os.path.join(os.path.dirname(__file__), 'store_data_script_4_1.py'), 'r').read()
504
from optparse import OptionParser
396
505
import glob
506
import os
507
import shutil
508
import string
509
import traceback
510
511
512
# Helper function to copy all meta data of a file or directory
513
def copy_permissions(src, dest):
514
	s_stat = os.stat(src)
515
	os.chown(dest, s_stat.st_uid, s_stat.st_gid)
516
	shutil.copymode(src, dest)
517
	shutil.copystat(src, dest)
518
	d_stat = os.stat(dest)
519
520
521
# Helper function to copy the files and directory
522
def copy_to_persistent_storage(src, dest):
523
	l_src = string.split(src, '/')
524
	# Ignore first empty entry
525
	if l_src[0] == '':
526
		l_src = l_src[1:]
527
	for j in range(0, len(l_src)):
528
		s = os.path.join('/', string.join(l_src[0:j + 1], '/'))
529
		d = os.path.join(dest, string.join(l_src[0:j + 1], '/'))
530
		if os.path.isdir(s):
531
			if not os.path.exists(d):
532
				os.makedirs(d)
533
				copy_permissions(s, d)
534
		elif os.path.islink(s):
535
			linkto = os.readlink(s)
536
			if os.path.exists(d) or os.path.islink(d):
537
				print 'rm %s' % d
538
				os.remove(d)
539
			print 'ln -sf %s %s' % (linkto, d)
540
			os.symlink(linkto, d)
541
		else:
542
			print 'cp %s %s' % (s, d)
543
			shutil.copy(s, d)
544
			copy_permissions(s, d)
545
546
547
def copy_files(src, dest):
548
	for f in glob.glob(src):
549
		copy_to_persistent_storage(f, dest)
550
551
552
def copy_recursive(src, dest):
553
	if not os.path.exists(src):
554
		return
555
	copy_to_persistent_storage(src, dest)
556
	for root, dirs, files in os.walk(src):
557
		for f in files:
558
			fullpath = os.path.join(root, f)
559
			copy_to_persistent_storage(fullpath, dest)
560
561
if __name__ == '__main__':
562
	parser = OptionParser('%prog [options]')
563
	parser.add_option('--app', dest='app', help='App ID')
564
	parser.add_option('--app-version', dest='app_version', help='Version of App')
565
	parser.add_option('--error-file', dest='error_file', help='Name of Error File')
566
	opts, args = parser.parse_args()
567
568
	dest = '/var/lib/univention-appcenter/apps/%s/conf/' % opts.app
569
570
	# The files and directories below the files directory are restored
571
	# automatically after the new container has been started
572
	store = '/var/lib/univention-appcenter/apps/%s/conf/files' % opts.app
573
574
	try:
575
		for f in glob.glob('/etc/univention/base*conf'):
576
			print 'cp %s %s' % (f, dest)
577
			shutil.copy(f, dest)
578
		copy_files('/etc/*.secret', store)
579
		copy_recursive('/etc/univention/ssl', store)
580
		copy_recursive('/var/univention-join', store)
581
		copy_recursive('/var/lib/univention-ldap/', store)
582
		copy_recursive('/var/lib/univention-directory-listener/', store)
583
		copy_recursive('/etc/univention/connector', store)
584
	except:
585
		traceback.print_exc()
586
		if opts.error_file:
587
			error_file = open(opts.error_file, 'a+')
588
			traceback.print_exc(file=error_file)
589
			error_file.close()
590
		raise
591
'''
592
397
593
def get_dummy_svg():
398
def get_dummy_svg():
594
	return '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
399
	return open(os.path.join(os.path.dirname(__file__), 'dummy.svg'), 'r').read()
595
<!-- Created with Inkscape (http://www.inkscape.org/) -->
596
597
<svg
598
   xmlns:dc="http://purl.org/dc/elements/1.1/"
599
   xmlns:cc="http://creativecommons.org/ns#"
600
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
601
   xmlns:svg="http://www.w3.org/2000/svg"
602
   xmlns="http://www.w3.org/2000/svg"
603
   version="1.1"
604
   width="110"
605
   height="126.122"
606
   id="svg3555">
607
  <defs
608
     id="defs3557" />
609
  <metadata
610
     id="metadata3560">
611
    <rdf:RDF>
612
      <cc:Work
613
         rdf:about="">
614
        <dc:format>image/svg+xml</dc:format>
615
        <dc:type
616
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
617
        <dc:title></dc:title>
618
      </cc:Work>
619
    </rdf:RDF>
620
  </metadata>
621
  <g
622
     transform="translate(-319.28571,-275.01547)"
623
     id="layer1">
624
    <g
625
       transform="matrix(1,0,0,-1,331.53071,388.89247)"
626
       id="g530">
627
      <path
628
         d="m 0,0 0,101.633 85.51,0 0,-66.758 C 85.51,15.552 61.655,23.293 61.655,23.293 61.655,23.293 68.958,0 50.941,0 L 0,0 z m 97.755,33.818 0,80.059 -110,0 0,-126.122 63.372,0 c 20.867,0 46.628,27.266 46.628,46.063 M 40.87,21.383 C 33.322,18.73 27.1,21.772 28.349,29.02 c 1.248,7.25 8.41,22.771 9.432,25.705 1.021,2.936 -0.937,3.74 -3.036,2.546 -1.21,-0.698 -3.009,-2.098 -4.554,-3.458 -0.427,0.862 -1.03,1.848 -1.482,2.791 2.52,2.526 6.732,5.912 11.72,7.138 5.958,1.471 15.916,-0.88 11.636,-12.269 -3.056,-8.117 -5.218,-13.719 -6.58,-17.89 -1.361,-4.173 0.256,-5.048 2.639,-3.423 1.862,1.271 3.846,3 5.299,4.342 0.673,-1.093 0.888,-1.442 1.553,-2.698 C 52.452,29.217 45.85,23.163 40.87,21.383 m 15.638,50.213 c -3.423,-2.913 -8.498,-2.85 -11.336,0.143 -2.838,2.992 -2.365,7.779 1.058,10.694 3.423,2.913 8.498,2.85 11.336,-0.141 2.838,-2.993 2.364,-7.781 -1.058,-10.696"
629
         id="path532"
630
         style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
631
    </g>
632
  </g>
633
</svg>'''
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dummy.svg (+40 lines)
Line 0    Link Here 
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4
<svg
5
   xmlns:dc="http://purl.org/dc/elements/1.1/"
6
   xmlns:cc="http://creativecommons.org/ns#"
7
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
   xmlns:svg="http://www.w3.org/2000/svg"
9
   xmlns="http://www.w3.org/2000/svg"
10
   version="1.1"
11
   width="110"
12
   height="126.122"
13
   id="svg3555">
14
  <defs
15
     id="defs3557" />
16
  <metadata
17
     id="metadata3560">
18
    <rdf:RDF>
19
      <cc:Work
20
         rdf:about="">
21
        <dc:format>image/svg+xml</dc:format>
22
        <dc:type
23
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
24
        <dc:title></dc:title>
25
      </cc:Work>
26
    </rdf:RDF>
27
  </metadata>
28
  <g
29
     transform="translate(-319.28571,-275.01547)"
30
     id="layer1">
31
    <g
32
       transform="matrix(1,0,0,-1,331.53071,388.89247)"
33
       id="g530">
34
      <path
35
         d="m 0,0 0,101.633 85.51,0 0,-66.758 C 85.51,15.552 61.655,23.293 61.655,23.293 61.655,23.293 68.958,0 50.941,0 L 0,0 z m 97.755,33.818 0,80.059 -110,0 0,-126.122 63.372,0 c 20.867,0 46.628,27.266 46.628,46.063 M 40.87,21.383 C 33.322,18.73 27.1,21.772 28.349,29.02 c 1.248,7.25 8.41,22.771 9.432,25.705 1.021,2.936 -0.937,3.74 -3.036,2.546 -1.21,-0.698 -3.009,-2.098 -4.554,-3.458 -0.427,0.862 -1.03,1.848 -1.482,2.791 2.52,2.526 6.732,5.912 11.72,7.138 5.958,1.471 15.916,-0.88 11.636,-12.269 -3.056,-8.117 -5.218,-13.719 -6.58,-17.89 -1.361,-4.173 0.256,-5.048 2.639,-3.423 1.862,1.271 3.846,3 5.299,4.342 0.673,-1.093 0.888,-1.442 1.553,-2.698 C 52.452,29.217 45.85,23.163 40.87,21.383 m 15.638,50.213 c -3.423,-2.913 -8.498,-2.85 -11.336,0.143 -2.838,2.992 -2.365,7.779 1.058,10.694 3.423,2.913 8.498,2.85 11.336,-0.141 2.838,-2.993 2.364,-7.781 -1.058,-10.696"
36
         id="path532"
37
         style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
38
    </g>
39
  </g>
40
</svg>
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/restore_data_script_4_1.py (+98 lines)
Line 0    Link Here 
1
#!/usr/bin/python2.7
2
from optparse import OptionParser
3
import os
4
import shutil
5
import string
6
import univention.config_registry
7
import traceback
8
9
BLACKLIST_UCR_VARIABLES = [
10
	'version/version',
11
	'version/erratalevel',
12
	'version/patchlevel',
13
	'version/releasename',
14
]
15
16
17
# Helper function to copy all meta data of a file or directory
18
def copy_permissions(src, dest):
19
	s_stat = os.stat(src)
20
	os.chown(dest, s_stat.st_uid, s_stat.st_gid)
21
	shutil.copymode(src, dest)
22
	shutil.copystat(src, dest)
23
24
25
def restore_files(source_dir):
26
	if not os.path.exists(source_dir):
27
		return
28
	for (path, dirs, files) in os.walk(source_dir):
29
		for d in dirs:
30
			r_path = string.replace(path, source_dir, '/', 1)
31
			dest = os.path.join(r_path, d)
32
			if not os.path.exists(dest):
33
				os.makedirs(dest)
34
			src = os.path.join(path, d)
35
			copy_permissions(src, dest)
36
		for i in files:
37
			src = os.path.join(path, i)
38
			dest = string.replace(src, source_dir, '', 1)
39
			if os.path.islink(src):
40
				linkto = os.readlink(src)
41
				if os.path.exists(dest) or os.path.islink(dest):
42
					print 'rm %s' % dest
43
					os.remove(dest)
44
				print 'ln -sf %s %s' % (linkto, dest)
45
				os.symlink(linkto, dest)
46
			else:
47
				print 'cp %s %s' % (src, dest)
48
				shutil.copy(src, dest)
49
				copy_permissions(src, dest)
50
51
52
def restore_ucr_layer(ucr_file, options):
53
	if not os.path.exists(ucr_file):
54
		return
55
	f = open(ucr_file, "r")
56
	vv = []
57
	for v in f.readlines():
58
		v = v.strip()
59
		if not v or v.startswith('#'):
60
			continue
61
		key, value = v.split(':', 1)
62
		if key not in BLACKLIST_UCR_VARIABLES:
63
			vv.append('%s=%s' % (key, value))
64
	if vv:
65
		print vv
66
		univention.config_registry.handler_set(vv, opts=options)
67
68
69
def main():
70
	parser = OptionParser('%prog [options]')
71
	parser.add_option('--app', dest='app', help='App ID')
72
	parser.add_option('--app-version', dest='app_version', help='Version of App')
73
	parser.add_option('--error-file', dest='error_file', help='Name of Error File')
74
	opts, args = parser.parse_args()
75
76
	conf_dir = '/var/lib/univention-appcenter/apps/%s/conf/' % opts.app
77
	source_dir = '/var/lib/univention-appcenter/apps/%s/conf/files' % opts.app
78
79
	try:
80
		restore_files(source_dir)
81
82
		print '** Restore forced UCR layer:'
83
		restore_ucr_layer(os.path.join(conf_dir, 'base-forced.conf'), {'force': True})
84
		print '** Restore ldap UCR layer'
85
		restore_ucr_layer(os.path.join(conf_dir, 'base-ldap.conf'), {'ldap-policy': True})
86
		print '** Restore normal UCR layer:'
87
		restore_ucr_layer(os.path.join(conf_dir, 'base.conf'), {})
88
	except:
89
		traceback.print_exc()
90
		if opts.error_file:
91
			error_file = open(opts.error_file, 'a+')
92
			traceback.print_exc(file=error_file)
93
			error_file.close()
94
		raise
95
96
97
if __name__ == '__main__':
98
	main()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/setup.sh (+11 lines)
Line 0    Link Here 
1
#!/bin/bash
2
eval "$(ucr shell)"
3
set -x -e
4
if [ "$version_version" = 4.0 ]; then
5
	repo=${repository_online_server#*://}
6
	ucr set repository/online/server="${repo%%/*}"
7
fi
8
univention-install --yes univention-apache
9
mkdir "/var/www/%(app_name)s"
10
echo "TEST-%(app_name)s" >>"/var/www/%(app_name)s/index.txt"
11
/usr/share/univention-docker-container-mode/setup "$@"
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/store_data_script_4_1.py (-2 / +91 lines)
Line 0    Link Here 
0
- 
1
#!/usr/bin/python2.7
1
--
2
from optparse import OptionParser
3
import glob
4
import os
5
import shutil
6
import traceback
7
8
9
# Helper function to copy all meta data of a file or directory
10
def copy_permissions(src, dest):
11
	s_stat = os.stat(src)
12
	os.chown(dest, s_stat.st_uid, s_stat.st_gid)
13
	shutil.copymode(src, dest)
14
	shutil.copystat(src, dest)
15
16
17
# Helper function to copy the files and directory
18
def copy_to_persistent_storage(src, dest):
19
	l_src = src.split('/')
20
	# Ignore first empty entry
21
	if l_src[0] == '':
22
		l_src = l_src[1:]
23
	for j in range(0, len(l_src)):
24
		s = os.path.join('/', '/'.join(l_src[0:j + 1]))
25
		d = os.path.join(dest, '/'.join(l_src[0:j + 1]))
26
		if os.path.isdir(s):
27
			if not os.path.exists(d):
28
				os.makedirs(d)
29
				copy_permissions(s, d)
30
		elif os.path.islink(s):
31
			linkto = os.readlink(s)
32
			if os.path.exists(d) or os.path.islink(d):
33
				print 'rm %s' % d
34
				os.remove(d)
35
			print 'ln -sf %s %s' % (linkto, d)
36
			os.symlink(linkto, d)
37
		else:
38
			print 'cp %s %s' % (s, d)
39
			shutil.copy(s, d)
40
			copy_permissions(s, d)
41
42
43
def copy_files(src, dest):
44
	for f in glob.glob(src):
45
		copy_to_persistent_storage(f, dest)
46
47
48
def copy_recursive(src, dest):
49
	if not os.path.exists(src):
50
		return
51
	copy_to_persistent_storage(src, dest)
52
	for root, dirs, files in os.walk(src):
53
		for f in files:
54
			fullpath = os.path.join(root, f)
55
			copy_to_persistent_storage(fullpath, dest)
56
57
58
def main():
59
	parser = OptionParser('%prog [options]')
60
	parser.add_option('--app', dest='app', help='App ID')
61
	parser.add_option('--app-version', dest='app_version', help='Version of App')
62
	parser.add_option('--error-file', dest='error_file', help='Name of Error File')
63
	opts, args = parser.parse_args()
64
65
	dest = '/var/lib/univention-appcenter/apps/%s/conf/' % opts.app
66
67
	# The files and directories below the files directory are restored
68
	# automatically after the new container has been started
69
	store = '/var/lib/univention-appcenter/apps/%s/conf/files' % opts.app
70
71
	try:
72
		for f in glob.glob('/etc/univention/base*conf'):
73
			print 'cp %s %s' % (f, dest)
74
			shutil.copy(f, dest)
75
		copy_files('/etc/*.secret', store)
76
		copy_recursive('/etc/univention/ssl', store)
77
		copy_recursive('/var/univention-join', store)
78
		copy_recursive('/var/lib/univention-ldap/', store)
79
		copy_recursive('/var/lib/univention-directory-listener/', store)
80
		copy_recursive('/etc/univention/connector', store)
81
	except:
82
		traceback.print_exc()
83
		if opts.error_file:
84
			error_file = open(opts.error_file, 'a+')
85
			traceback.print_exc(file=error_file)
86
			error_file.close()
87
		raise
88
89
90
if __name__ == '__main__':
91
	main()
2
.../test/ucs-test/univention/testing/debian_package.py   | 16 ++++++++--------
92
.../test/ucs-test/univention/testing/debian_package.py   | 16 ++++++++--------
3
1 file changed, 8 insertions(+), 8 deletions(-)
93
1 file changed, 8 insertions(+), 8 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/univention/testing/debian_package.py (-10 / +8 lines)
 Lines 76-95   class DebianPackage(): Link Here 
76
		deb_package = os.path.join(self._package_tempdir, deb_file)
76
		deb_package = os.path.join(self._package_tempdir, deb_file)
77
		return deb_package
77
		return deb_package
78
78
79
	def __create_file_from_buffer(self, path, file_buffer):
79
	def __create_file_from_buffer(self, path, file_buffer, mode=None):
80
		f = open(path, 'w')
80
		f = open(path, 'w')
81
		f.write(file_buffer)
81
		f.write(file_buffer)
82
		f.close()
82
		f.close()
83
		if mode:
84
			os.chmod(path, mode)
83
85
84
	def create_join_script_from_buffer(self, joinscript_name, joinscript_buffer):
86
	def create_join_script_from_buffer(self, joinscript_name, joinscript_buffer):
85
		self.__join_file = os.path.join(self._package_path, joinscript_name)
87
		self.__join_file = os.path.join(self._package_path, joinscript_name)
86
		self.__create_file_from_buffer(self.__join_file, joinscript_buffer)
88
		self.__create_file_from_buffer(self.__join_file, joinscript_buffer, 0755)
87
		os.chmod(self.__join_file, 0755)
88
89
89
	def create_unjoin_script_from_buffer(self, unjoinscript_name, unjoinscript_buffer):
90
	def create_unjoin_script_from_buffer(self, unjoinscript_name, unjoinscript_buffer):
90
		self.__unjoin_file = os.path.join(self._package_path, unjoinscript_name)
91
		self.__unjoin_file = os.path.join(self._package_path, unjoinscript_name)
91
		self.__create_file_from_buffer(self.__unjoin_file, unjoinscript_buffer)
92
		self.__create_file_from_buffer(self.__unjoin_file, unjoinscript_buffer, 0755)
92
		os.chmod(self.__unjoin_file, 0755)
93
93
94
	def create_usr_share_file_from_buffer(self, share_filename, schema_buffer):
94
	def create_usr_share_file_from_buffer(self, share_filename, schema_buffer):
95
		share_file = os.path.join(self._package_path, 'usr/share/%s' % self._package_name, share_filename)
95
		share_file = os.path.join(self._package_path, 'usr/share/%s' % self._package_name, share_filename)
 Lines 98-106   class DebianPackage(): Link Here 
98
			os.makedirs(dirpath)
98
			os.makedirs(dirpath)
99
		self.__create_file_from_buffer(share_file, schema_buffer)
99
		self.__create_file_from_buffer(share_file, schema_buffer)
100
100
101
	def create_debian_file_from_buffer(self, debian_filename, debian_buffer):
101
	def create_debian_file_from_buffer(self, debian_filename, debian_buffer, mode=None):
102
		deb_file = os.path.join(self._package_debian_path, debian_filename)
102
		deb_file = os.path.join(self._package_debian_path, debian_filename)
103
		self.__create_file_from_buffer(deb_file, debian_buffer)
103
		self.__create_file_from_buffer(deb_file, debian_buffer, mode)
104
104
105
	def build(self):
105
	def build(self):
106
		install = []
106
		install = []
 Lines 170-176   Description: UCS - Test package Link Here 
170
%:
170
%:
171
	dh $@
171
	dh $@
172
'''
172
'''
173
		self.create_debian_file_from_buffer('rules', rules)
173
		self.create_debian_file_from_buffer('rules', rules, 0755)
174
174
175
	def _create_compat(self):
175
	def _create_compat(self):
176
		compat = '''7
176
		compat = '''7
177
- 
178
--
179
.../ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini      | 2 +-
177
.../ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini      | 2 +-
180
.../ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3     | 2 +-
178
.../ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3     | 2 +-
181
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install   | 2 +-
179
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install   | 2 +-
182
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave  | 2 +-
180
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave  | 2 +-
183
.../ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage   | 2 +-
181
.../ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage   | 2 +-
184
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst   | 5 ++++-
182
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst   | 5 ++++-
185
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy  | 2 +-
183
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy  | 2 +-
186
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop | 3 ++-
184
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop | 3 ++-
187
.../ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package   | 2 +-
185
.../ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package   | 2 +-
188
.../ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation    | 2 +-
186
.../ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation    | 2 +-
189
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature  | 3 ++-
187
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature  | 3 ++-
190
.../ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify  | 2 +-
188
.../ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify  | 2 +-
191
.../ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available  | 5 ++++-
189
.../ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available  | 5 ++++-
192
.../ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade | 2 +-
190
.../ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade | 2 +-
193
.../tests/80_docker/65_app_container_upgrade_dockerallowedimage      | 4 ++--
191
.../tests/80_docker/65_app_container_upgrade_dockerallowedimage      | 4 ++--
194
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling   | 2 +-
192
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling   | 2 +-
195
.../ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive   | 3 +--
193
.../ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive   | 3 +--
196
.../ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect    | 3 +--
194
.../ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect    | 3 +--
197
.../test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive   | 4 +---
195
.../test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive   | 4 +---
198
.../test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect    | 4 +---
196
.../test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect    | 4 +---
199
.../test/ucs-test/tests/80_docker/79_app_ports_already_used          | 3 +--
197
.../test/ucs-test/tests/80_docker/79_app_ports_already_used          | 3 +--
200
21 files changed, 30 insertions(+), 29 deletions(-)
198
21 files changed, 30 insertions(+), 29 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/10_pull_appbox_mini (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (docker_login, docker_pull)
7
7
8
if __name__ == '__main__':
8
if __name__ == '__main__':
9
	docker_login()
9
	docker_login()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/40_app_install_4_0-3 (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, App, store_data_script_4_1)
7
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
8
8
9
9
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/51_app_install (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
8
8
9
if __name__ == '__main__':
9
if __name__ == '__main__':
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave (-1 / +1 lines)
 Lines 8-14    Link Here 
8
##  - 39792
8
##  - 39792
9
##  - 39801
9
##  - 39801
10
10
11
from dockertest import *
11
from dockertest import (Appcenter, get_app_name, get_app_version, App)
12
from univention.testing.utils import get_ldap_connection
12
from univention.testing.utils import get_ldap_connection
13
import ldap
13
import ldap
14
import time
14
import time
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/53_missing_dockerimage (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import fail
7
from univention.testing.utils import fail
8
from univention.testing.internal import package_installed
8
from univention.testing.internal import package_installed
9
9
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/54_app_preinst (-1 / +4 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (
7
	Appcenter, get_app_name, get_app_version, App,
8
	UCSTest_DockerApp_VerifyFailed, UCSTest_DockerApp_InstallationFailed,
9
)
7
10
8
11
9
def create_app(fail_in_preinst):
12
def create_app(fail_in_preinst):
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/55_app_modproxy (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
7
8
if __name__ == '__main__':
8
if __name__ == '__main__':
9
	with Appcenter() as appcenter:
9
	with Appcenter() as appcenter:
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop (-1 / +2 lines)
 Lines 3-11    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
import subprocess
7
import subprocess
8
import time
8
import time
9
from univention.testing.utils import fail
9
10
10
if __name__ == '__main__':
11
if __name__ == '__main__':
11
	nscd_stopped = False
12
	nscd_stopped = False
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/57_app_without_package (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
8
8
9
if __name__ == '__main__':
9
if __name__ == '__main__':
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import fail, get_ldap_connection
7
from univention.testing.utils import fail, get_ldap_connection
8
import os
8
import os
9
import subprocess
9
import subprocess
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature (-1 / +2 lines)
 Lines 4-10    Link Here 
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
import os
6
import os
7
from dockertest import *
7
from dockertest import Appcenter
8
from univention.config_registry import handler_set
8
from subprocess import call
9
from subprocess import call
9
from univention.testing.utils import fail
10
from univention.testing.utils import fail
10
11
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/61_app_updater_identify (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App, UCSTest_Docker_Exception)
7
7
8
class UCSTest_DockerApp_Identify(UCSTest_Docker_Exception):
8
class UCSTest_DockerApp_Identify(UCSTest_Docker_Exception):
9
	pass
9
	pass
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available (-1 / +4 lines)
 Lines 5-14    Link Here 
5
## versions:
5
## versions:
6
##  4.1-0: skip
6
##  4.1-0: skip
7
7
8
from dockertest import *
8
from dockertest import (Appcenter, get_app_name, App)
9
from univention.testing.debian_package import DebianPackage
9
from univention.testing.debian_package import DebianPackage
10
from univention.testing.utils import get_ldap_connection, fail
10
from univention.testing.utils import get_ldap_connection, fail
11
from univention.config_registry import ConfigRegistry
11
from univention.config_registry import ConfigRegistry
12
import os
13
import shutil
14
import subprocess
12
15
13
def copy_package_to_appcenter(ucs_version, app_directory, package_name):
16
def copy_package_to_appcenter(ucs_version, app_directory, package_name):
14
	target = os.path.join('/var/www/univention-repository/%s/maintained/component' % ucs_version, '%s/all' % app_directory)
17
	target = os.path.join('/var/www/univention-repository/%s/maintained/component' % ucs_version, '%s/all' % app_directory)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/64_app_container_upgrade (-1 / +1 lines)
 Lines 3-9    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, App, store_data_script_4_1)
7
from univention.testing.utils import get_ldap_connection, fail
7
from univention.testing.utils import get_ldap_connection, fail
8
from univention.config_registry import ConfigRegistry
8
from univention.config_registry import ConfigRegistry
9
9
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/65_app_container_upgrade_dockerallowedimage (-2 / +2 lines)
 Lines 5-12    Link Here 
5
## versions:
5
## versions:
6
##  4.1-0: skip
6
##  4.1-0: skip
7
7
8
from dockertest import *
8
from dockertest import (Appcenter, get_app_name, App)
9
from univention.testing.utils import get_ldap_connection,fail
9
from univention.testing.utils import get_ldap_connection, fail
10
from univention.config_registry import ConfigRegistry
10
from univention.config_registry import ConfigRegistry
11
11
12
12
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/70_app_scaling (-1 / +1 lines)
 Lines 4-10    Link Here 
4
## timeout: 7200
4
## timeout: 7200
5
## exposure: dangerous
5
## exposure: dangerous
6
6
7
from dockertest import *
7
from dockertest import (Appcenter, get_app_name, get_app_version, App)
8
8
9
DOCKER_APP_COUNT = 20
9
DOCKER_APP_COUNT = 20
10
10
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/75_app_ports_exclusive (-2 / +1 lines)
 Lines 3-10    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import get_ldap_connection
8
from univention.testing.utils import is_port_open
7
from univention.testing.utils import is_port_open
9
from univention.testing.utils import restart_firewall
8
from univention.testing.utils import restart_firewall
10
9
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/76_app_ports_redirect (-2 / +1 lines)
 Lines 3-10    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import get_ldap_connection
8
from univention.testing.utils import is_port_open
7
from univention.testing.utils import is_port_open
9
from univention.testing.utils import restart_firewall
8
from univention.testing.utils import restart_firewall
10
9
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/77_app_ports_conflicts_exclusive (-3 / +1 lines)
 Lines 3-15    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_version, App, UCSTest_DockerApp_InstallationFailed)
7
from univention.testing.utils import get_ldap_connection
8
from univention.testing.utils import is_port_open
7
from univention.testing.utils import is_port_open
9
8
10
import socket
9
import socket
11
import pytest
10
import pytest
12
import time
13
11
14
if __name__ == '__main__':
12
if __name__ == '__main__':
15
	with Appcenter() as appcenter:
13
	with Appcenter() as appcenter:
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/78_app_ports_conflicts_redirect (-3 / +1 lines)
 Lines 3-15    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_version, App, UCSTest_DockerApp_InstallationFailed)
7
from univention.testing.utils import get_ldap_connection
8
from univention.testing.utils import is_port_open
7
from univention.testing.utils import is_port_open
9
8
10
import socket
9
import socket
11
import pytest
10
import pytest
12
import time
13
11
14
if __name__ == '__main__':
12
if __name__ == '__main__':
15
	with Appcenter() as appcenter:
13
	with Appcenter() as appcenter:
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/79_app_ports_already_used (-4 / +1 lines)
 Lines 3-12    Link Here 
3
## tags: [docker]
3
## tags: [docker]
4
## exposure: dangerous
4
## exposure: dangerous
5
5
6
from dockertest import *
6
from dockertest import (Appcenter, get_app_name, get_app_version, App)
7
from univention.testing.utils import get_ldap_connection
7
from univention.testing.utils import get_ldap_connection
8
import socket
8
import socket
9
import sys
10
9
11
def _open_port(port):
10
def _open_port(port):
12
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
11
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
13
- 
14
--
15
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 +-
12
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave (-3 / +1 lines)
 Lines 38-44   univention-install --yes --no-install-recommends univention-server-slave univent Link Here 
38
38
39
			try:
39
			try:
40
				lo = get_ldap_connection()
40
				lo = get_ldap_connection()
41
			except ldap.SERVER_DOWN():
41
			except ldap.SERVER_DOWN:
42
				print 'LDAP connection failed. Wait for ten seconds and try again.'
42
				print 'LDAP connection failed. Wait for ten seconds and try again.'
43
				time.sleep(60)
43
				time.sleep(60)
44
				lo = get_ldap_connection()
44
				lo = get_ldap_connection()
45
- 
46
--
47
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 +-
45
.../ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave     | 2 +-
48
1 file changed, 1 insertion(+), 1 deletion(-)
46
1 file changed, 1 insertion(+), 1 deletion(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/52_app_install_dc_slave (-3 / +1 lines)
 Lines 39-45   univention-install --yes --no-install-recommends univention-server-slave univent Link Here 
39
			try:
39
			try:
40
				lo = get_ldap_connection()
40
				lo = get_ldap_connection()
41
			except ldap.SERVER_DOWN:
41
			except ldap.SERVER_DOWN:
42
				print 'LDAP connection failed. Wait for ten seconds and try again.'
42
				print 'LDAP connection failed. Wait for 60 seconds and try again.'
43
				time.sleep(60)
43
				time.sleep(60)
44
				lo = get_ldap_connection()
44
				lo = get_ldap_connection()
45
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionDomainController)(univentionServerRole=slave)(!(aRecord=*)))' % app_name, unique=True, required=True)
45
			print lo.searchDn(filter='(&(cn=%s-*)(objectClass=univentionDomainController)(univentionServerRole=slave)(!(aRecord=*)))' % app_name, unique=True, required=True)
46
- 
47
--
48
.../test/ucs-test/tests/80_docker/56_app_nscd_stop |  4 +-
46
.../test/ucs-test/tests/80_docker/56_app_nscd_stop |  4 +-
49
.../ucs-test/tests/80_docker/58_app_uninstallation |  2 +-
47
.../ucs-test/tests/80_docker/58_app_uninstallation |  2 +-
50
.../tests/80_docker/59_app_center_signature        | 16 +++---
48
.../tests/80_docker/59_app_center_signature        | 16 +++---
51
.../tests/80_docker/62_app_update_available        |  9 ++--
49
.../tests/80_docker/62_app_update_available        |  9 ++--
52
.../test/ucs-test/tests/80_docker/dockertest.py    | 62 +++++++++++++++++-----
50
.../test/ucs-test/tests/80_docker/dockertest.py    | 62 +++++++++++++++++-----
53
5 files changed, 63 insertions(+), 30 deletions(-)
51
5 files changed, 63 insertions(+), 30 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/56_app_nscd_stop (-2 / +2 lines)
 Lines 31-37   if __name__ == '__main__': Link Here 
31
31
32
			ncs_container_pid_old = app.execute_command_in_container('pidof nscd')
32
			ncs_container_pid_old = app.execute_command_in_container('pidof nscd')
33
			print ncs_container_pid_old
33
			print ncs_container_pid_old
34
			subprocess.call('/etc/init.d/nscd stop', shell=True)
34
			subprocess.call(('/etc/init.d/nscd', 'stop'))
35
			nscd_stopped = True
35
			nscd_stopped = True
36
			time.sleep(3)
36
			time.sleep(3)
37
			ncs_container_pid_new = app.execute_command_in_container('pidof nscd')
37
			ncs_container_pid_new = app.execute_command_in_container('pidof nscd')
 Lines 40-45   if __name__ == '__main__': Link Here 
40
				fail('nscd pid in container have been changed. old: [%s], new: [%s]' % (ncs_container_pid_old, ncs_container_pid_new))
40
				fail('nscd pid in container have been changed. old: [%s], new: [%s]' % (ncs_container_pid_old, ncs_container_pid_new))
41
		finally:
41
		finally:
42
			if nscd_stopped:
42
			if nscd_stopped:
43
				subprocess.call('/etc/init.d/nscd start', shell=True)
43
				subprocess.call(('/etc/init.d/nscd', 'start'))
44
			app.uninstall()
44
			app.uninstall()
45
			app.remove()
45
			app.remove()
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/58_app_uninstallation (-1 / +1 lines)
 Lines 79-83   echo "Test 123 Conf" >/var/lib/univention-appcenter/apps/%(app_name)s/conf/test1 Link Here 
79
		# Check for the backup container
79
		# Check for the backup container
80
		res = subprocess.call('docker images | grep appcenter-backup-%s' % app.app_name, shell=True)
80
		res = subprocess.call('docker images | grep appcenter-backup-%s' % app.app_name, shell=True)
81
		if res != 0:
81
		if res != 0:
82
			subprocess.call('docker images' % app.app_name, shell=True)
82
			subprocess.call(('docker', 'images'))
83
			fail('Backup container appcenter-backup-%s was not found' % app.app_name)
83
			fail('Backup container appcenter-backup-%s was not found' % app.app_name)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature (-8 / +8 lines)
 Lines 22-28   class SyncedAppcenter(Appcenter): Link Here 
22
		handler_set([
22
		handler_set([
23
			'repository/app_center/server=%s' % (self.upstream_appcenter)
23
			'repository/app_center/server=%s' % (self.upstream_appcenter)
24
		])
24
		])
25
		call('univention-app update', shell=True)
25
		call(('univention-app', 'update'))
26
		handler_set([
26
		handler_set([
27
			'repository/app_center/server=%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
27
			'repository/app_center/server=%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
28
		])
28
		])
 Lines 35-41   class SyncedAppcenter(Appcenter): Link Here 
35
		if not os.path.exists(d):
35
		if not os.path.exists(d):
36
			os.makedirs(d)
36
			os.makedirs(d)
37
37
38
		call('wget -O /var/www/%s %s/%s' % (f, self.upstream_appcenter, f), shell=True)
38
		call(('wget', '-O', '/var/www/%s' % f, '%s/%s' % (self.upstream_appcenter, f))
39
39
40
	def download_index_json(self):
40
	def download_index_json(self):
41
		self.download('meta-inf/%s/index.json.gz' % self.vv)
41
		self.download('meta-inf/%s/index.json.gz' % self.vv)
 Lines 52-58   class SyncedAppcenter(Appcenter): Link Here 
52
52
53
	def test_index_without_gpg(self):
53
	def test_index_without_gpg(self):
54
		self.download_index_json()
54
		self.download_index_json()
55
		res = call('univention-app update', shell=True)
55
		res = call(('univention-app', 'update'))
56
		if res == 0:
56
		if res == 0:
57
			fail('_test_index_without_gpg failed')
57
			fail('_test_index_without_gpg failed')
58
		print '### _test_index_without_gpg passed'
58
		print '### _test_index_without_gpg passed'
 Lines 60-66   class SyncedAppcenter(Appcenter): Link Here 
60
	def test_index_with_gpg(self):
60
	def test_index_with_gpg(self):
61
		self.download_index_json()
61
		self.download_index_json()
62
		self.download_index_json_gpg()
62
		self.download_index_json_gpg()
63
		res = call('univention-app update', shell=True)
63
		res = call(('univention-app', 'update'))
64
		if res != 0:
64
		if res != 0:
65
			fail('_test_index_with_gpg failed')
65
			fail('_test_index_with_gpg failed')
66
		print '### _test_index_with_gpg passed'
66
		print '### _test_index_with_gpg passed'
 Lines 70-76   class SyncedAppcenter(Appcenter): Link Here 
70
		self.download_index_json_gpg()
70
		self.download_index_json_gpg()
71
		f = '/var/www/meta-inf/%s/index.json' % self.vv
71
		f = '/var/www/meta-inf/%s/index.json' % self.vv
72
		call('gunzip %(f)s.gz; echo "foo" >>%(f)s; gzip %(f)s' % {'f':f}, shell=True)
72
		call('gunzip %(f)s.gz; echo "foo" >>%(f)s; gzip %(f)s' % {'f':f}, shell=True)
73
		res = call('univention-app update', shell=True)
73
		res = call(('univention-app', 'update'))
74
		if res == 0:
74
		if res == 0:
75
			fail('_test_modify_index failed')
75
			fail('_test_modify_index failed')
76
		print '### _test_modify_index passed'
76
		print '### _test_modify_index passed'
 Lines 81-89   class SyncedAppcenter(Appcenter): Link Here 
81
		self.remove_from_cache('dudle-docker.ini')
81
		self.remove_from_cache('dudle-docker.ini')
82
		self.download('meta-inf/%s/dudle-docker/dudle-docker.ini' % self.vv)
82
		self.download('meta-inf/%s/dudle-docker/dudle-docker.ini' % self.vv)
83
		call('echo "## SIGNATURE TEST ###" >>/var/www/meta-inf/%s/dudle-docker/dudle-docker.ini' % self.vv, shell=True)
83
		call('echo "## SIGNATURE TEST ###" >>/var/www/meta-inf/%s/dudle-docker/dudle-docker.ini' % self.vv, shell=True)
84
		res = call('univention-app update', shell=True)
84
		res = call(('univention-app', 'update'))
85
		# dudle-docker must have been removed
85
		# dudle-docker must have been removed
86
		res = call('univention-app get dudle-docker name', shell=True)
86
		res = call(('univention-app', 'get', 'dudle-docker', 'name'))
87
		if res == 0:
87
		if res == 0:
88
			fail('_test_modify_ini failed')
88
			fail('_test_modify_ini failed')
89
		print '### _test_modify_ini passed'
89
		print '### _test_modify_ini passed'
 Lines 94-100   class SyncedAppcenter(Appcenter): Link Here 
94
		self.remove_from_cache('owncloud8-docker_20150917.inst')
94
		self.remove_from_cache('owncloud8-docker_20150917.inst')
95
		self.download('univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv)
95
		self.download('univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv)
96
		call('echo "## SIGNATURE TEST ###" >>/var/www/univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv, shell=True)
96
		call('echo "## SIGNATURE TEST ###" >>/var/www/univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv, shell=True)
97
		res = call('univention-app update', shell=True)
97
		res = call(('univention-app', 'update'))
98
		# Check only if the file was removed from th local cache
98
		# Check only if the file was removed from th local cache
99
		if self.file_exists_in_cache('owncloud8-docker_20150917.inst'):
99
		if self.file_exists_in_cache('owncloud8-docker_20150917.inst'):
100
			fail('_test_modify_inst failed')
100
			fail('_test_modify_inst failed')
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/62_app_update_available (-6 / +3 lines)
 Lines 17-32   def copy_package_to_appcenter(ucs_version, app_directory, package_name): Link Here 
17
	target = os.path.join('/var/www/univention-repository/%s/maintained/component' % ucs_version, '%s/all' % app_directory)
17
	target = os.path.join('/var/www/univention-repository/%s/maintained/component' % ucs_version, '%s/all' % app_directory)
18
	print 'cp %s %s' % (package_name, target)
18
	print 'cp %s %s' % (package_name, target)
19
	shutil.copy(package_name, target)
19
	shutil.copy(package_name, target)
20
	print '''
20
	cmd = '''
21
		cd /var/www/univention-repository/%(version)s/maintained/component;
21
		cd /var/www/univention-repository/%(version)s/maintained/component;
22
		apt-ftparchive packages %(app)s/all >%(app)s/all/Packages;
22
		apt-ftparchive packages %(app)s/all >%(app)s/all/Packages;
23
		gzip -c %(app)s/all/Packages >%(app)s/all/Packages.gz
23
		gzip -c %(app)s/all/Packages >%(app)s/all/Packages.gz
24
	''' % {'version': ucs_version, 'app': app_directory}
24
	''' % {'version': ucs_version, 'app': app_directory}
25
	subprocess.call('''
25
	print cmd
26
		cd /var/www/univention-repository/%(version)s/maintained/component;
26
	subprocess.call(cmd, shell=True)
27
		apt-ftparchive packages %(app)s/all >%(app)s/all/Packages;
28
		gzip -c %(app)s/all/Packages >%(app)s/all/Packages.gz
29
	''' % {'version': ucs_version, 'app': app_directory}, shell=True)
30
27
31
if __name__ == '__main__':
28
if __name__ == '__main__':
32
	with Appcenter() as appcenter:
29
	with Appcenter() as appcenter:
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-15 / +49 lines)
 Lines 85-91   class UCSTest_DockerApp_ModProxyFailed(Exception): Link Here 
85
85
86
86
87
def docker_login(server='docker.software-univention.de'):
87
def docker_login(server='docker.software-univention.de'):
88
	ret = subprocess.call(['docker', 'login', '-e', 'foo@bar', '-u', 'ucs', '-p', 'readonly', server])
88
	ret = subprocess.call((
89
		'docker',
90
		'login',
91
		'-e', 'foo@bar',
92
		'-u', 'ucs',
93
		'-p', 'readonly',
94
		server,
95
	))
89
	if ret != 0:
96
	if ret != 0:
90
		raise UCSTest_Docker_LoginFailed()
97
		raise UCSTest_Docker_LoginFailed()
91
98
 Lines 201-210   class App: Link Here 
201
	def install(self):
208
	def install(self):
202
		self._update()
209
		self._update()
203
		admin_user = self.ucr.get('tests/domainadmin/account').split(',')[0][len('uid='):]
210
		admin_user = self.ucr.get('tests/domainadmin/account').split(',')[0][len('uid='):]
204
		# ret = subprocess.call('univention-app install --noninteractive --do-not-revert --username=%s --pwdfile=%s %s' %
211
		cmd = (
205
		cmd = 'univention-app install --noninteractive --username=%s --pwdfile=%s %s' % (admin_user, self.ucr.get('tests/domainadmin/pwdfile'), self.app_name)
212
			'univention-app', 'install',
213
			'--noninteractive',
214
			'--username=%s' % admin_user,
215
			'--pwdfile=%s' % self.ucr.get('tests/domainadmin/pwdfile'),
216
			self.app_name,
217
		)
206
		print cmd
218
		print cmd
207
		ret = subprocess.call(cmd, shell=True)
219
		ret = subprocess.call(cmd)
208
		if ret != 0:
220
		if ret != 0:
209
			raise UCSTest_DockerApp_InstallationFailed()
221
			raise UCSTest_DockerApp_InstallationFailed()
210
222
 Lines 220-227   class App: Link Here 
220
232
221
	def upgrade(self):
233
	def upgrade(self):
222
		self._update()
234
		self._update()
223
		ret = subprocess.call('univention-app upgrade --noninteractive --username=%s --pwdfile=%s %s' %
235
		ret = subprocess.call((
224
					(self.admin_user, self.admin_pwdfile, self.app_name), shell=True)
236
			'univention-app', 'upgrade',
237
			'--noninteractive',
238
			'--username=%s' % self.admin_user,
239
			'--pwdfile=%s' % self.admin_pwdfile,
240
			self.app_name,
241
		))
225
		if ret != 0:
242
		if ret != 0:
226
			raise UCSTest_DockerApp_UpgradeFailed()
243
			raise UCSTest_DockerApp_UpgradeFailed()
227
		self.ucr.load()
244
		self.ucr.load()
 Lines 229-253   class App: Link Here 
229
		self.installed = True
246
		self.installed = True
230
247
231
	def verify(self, joined=True):
248
	def verify(self, joined=True):
232
		ret = subprocess.call('univention-app status %s' % (self.app_name), shell=True)
249
		ret = subprocess.call(('univention-app', 'status', self.app_name))
233
		if ret != 0:
250
		if ret != 0:
234
			raise UCSTest_DockerApp_VerifyFailed()
251
			raise UCSTest_DockerApp_VerifyFailed()
235
252
236
		if joined:
253
		if joined:
237
			ret = subprocess.call('docker exec %s univention-check-join-status' % self.container_id, stderr=subprocess.STDOUT, shell=True)
254
			ret = subprocess.call((
255
				'docker',
256
				'exec', self.container_id,
257
				'univention-check-join-status',
258
			), stderr=subprocess.STDOUT)
238
			if ret != 0:
259
			if ret != 0:
239
				raise UCSTest_DockerApp_VerifyFailed()
260
				raise UCSTest_DockerApp_VerifyFailed()
240
261
241
	def uninstall(self):
262
	def uninstall(self):
242
		if self.installed:
263
		if self.installed:
243
			ret = subprocess.call('univention-app remove --noninteractive --username=%s --pwdfile=%s %s' %
264
			ret = subprocess.call((
244
						(self.admin_user, self.admin_pwdfile, self.app_name), shell=True)
265
				'univention-app', 'remove',
266
				'--noninteractive',
267
				'--username=%s' % self.admin_user,
268
				'--pwdfile=%s' % self.admin_pwdfile,
269
				self.app_name,
270
			))
245
			if ret != 0:
271
			if ret != 0:
246
				raise UCSTest_DockerApp_RemoveFailed()
272
				raise UCSTest_DockerApp_RemoveFailed()
247
273
248
	def execute_command_in_container(self, cmd):
274
	def execute_command_in_container(self, cmd):
249
		print 'Execute: %s' % cmd
275
		print 'Execute: %s' % cmd
250
		return subprocess.check_output('docker exec %s %s' % (self.container_id, cmd), stderr=subprocess.STDOUT, shell=True)
276
		return subprocess.check_output((
277
			'docker',
278
			'exec', self.container_id,
279
			'/bin/bash', '-c', cmd,
280
		), stderr=subprocess.STDOUT)
251
281
252
	def remove(self):
282
	def remove(self):
253
		if self.package:
283
		if self.package:
 Lines 368-375   class Appcenter: Link Here 
368
			if not os.path.isdir(directory):
398
			if not os.path.isdir(directory):
369
				continue
399
				continue
370
			print 'create_appcenter_json.py for %s' % vv
400
			print 'create_appcenter_json.py for %s' % vv
371
			subprocess.call('create_appcenter_json.py -u %(version)s -d /var/www -o /var/www/meta-inf/%(version)s/index.json.gz -s http://%(fqdn)s' %
401
			var = {'version': vv, 'fqdn': '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])}, shell=True)
372
				 {'version': vv, 'fqdn': '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])}, shell=True)
402
			subprocess.call((
403
				'create_appcenter_json.py',
404
				'-u', vv,
405
				'-d', '/var/www',
406
				'-o', '/var/www/meta-inf/%(version)s/index.json.gz' % var,
407
				'-s', 'http://%(fqdn)s' % var,
408
			))
373
409
374
	def cleanup(self):
410
	def cleanup(self):
375
		if self.meta_inf_created:
411
		if self.meta_inf_created:
376
- 
377
--
378
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature     | 2 ++
412
.../ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature     | 2 ++
379
1 file changed, 2 insertions(+)
413
1 file changed, 2 insertions(+)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/59_app_center_signature (-2 / +2 lines)
 Lines 95-100   class SyncedAppcenter(Appcenter): Link Here 
95
		self.download('univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv)
95
		self.download('univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv)
96
		call('echo "## SIGNATURE TEST ###" >>/var/www/univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv, shell=True)
96
		call('echo "## SIGNATURE TEST ###" >>/var/www/univention-repository/%s/maintained/component/owncloud8-docker_20150917/inst' % self.vv, shell=True)
97
		res = call(('univention-app', 'update'))
97
		res = call(('univention-app', 'update'))
98
		if res == 0:
99
			print 'update failed: %d' % res
98
		# Check only if the file was removed from th local cache
100
		# Check only if the file was removed from th local cache
99
		if self.file_exists_in_cache('owncloud8-docker_20150917.inst'):
101
		if self.file_exists_in_cache('owncloud8-docker_20150917.inst'):
100
			fail('_test_modify_inst failed')
102
			fail('_test_modify_inst failed')
101
- 
102
--
103
.../test/ucs-test/tests/80_docker/dockertest.py    | 68 +++++++++++++---------
103
.../test/ucs-test/tests/80_docker/dockertest.py    | 68 +++++++++++++---------
104
1 file changed, 42 insertions(+), 26 deletions(-)
104
1 file changed, 42 insertions(+), 26 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-28 / +42 lines)
 Lines 38-43   import shutil Link Here 
38
import subprocess
38
import subprocess
39
import urllib2
39
import urllib2
40
40
41
META_INF = '/var/www/meta-inf'
42
REPO_DIR = '/var/www/univention-repository'
41
43
42
44
43
class UCSTest_Docker_Exception(Exception):
45
class UCSTest_Docker_Exception(Exception):
 Lines 284-293   class App: Link Here 
284
			self.package.remove()
286
			self.package.remove()
285
287
286
	def _dump_ini(self):
288
	def _dump_ini(self):
287
		if not os.path.exists('/var/www/meta-inf/%s' % self.ucs_version):
289
		path = os.path.join(META_INF, self.ucs_version)
288
			os.makedirs('/var/www/meta-inf/%s' % self.ucs_version)
290
		if not os.path.exists(path):
291
			os.makedirs(path)
289
292
290
		target = os.path.join('/var/www/meta-inf/%s' % self.ucs_version, '%s.ini' % self.app_directory)
293
		target = os.path.join(path, '%s.ini' % self.app_directory)
291
		f = open(target, 'w')
294
		f = open(target, 'w')
292
		print 'Write ini file: %s' % target
295
		print 'Write ini file: %s' % target
293
		f.write('[Application]\n')
296
		f.write('[Application]\n')
 Lines 297-312   class App: Link Here 
297
			print '%s: %s' % (key, self.ini[key])
300
			print '%s: %s' % (key, self.ini[key])
298
		print
301
		print
299
		f.close()
302
		f.close()
300
		svg = os.path.join('/var/www/meta-inf/%s' % self.ucs_version, self.ini.get('Logo'))
303
		svg = os.path.join(path, self.ini.get('Logo'))
301
		f = open(svg, 'w')
304
		f = open(svg, 'w')
302
		f.write(get_dummy_svg())
305
		f.write(get_dummy_svg())
303
		f.close()
306
		f.close()
304
307
305
	def _dump_scripts(self):
308
	def _dump_scripts(self):
309
		comp_path = os.path.join(
310
			REPO_DIR,
311
			self.ucs_version,
312
			'maintained/component',
313
			self.app_directory,
314
		)
315
		if not os.path.exists(comp_path):
316
			os.makedirs(comp_path)
317
306
		for script in self.scripts.keys():
318
		for script in self.scripts.keys():
307
			comp_path = os.path.join('/var/www/univention-repository/%s/maintained/component' % self.ucs_version, '%s' % self.app_directory)
308
			if not os.path.exists(comp_path):
309
				os.makedirs(comp_path)
310
			target = os.path.join(comp_path, script)
319
			target = os.path.join(comp_path, script)
311
320
312
			print 'Create %s' % target
321
			print 'Create %s' % target
 Lines 317-323   class App: Link Here 
317
			f.close()
326
			f.close()
318
327
319
	def _copy_package(self):
328
	def _copy_package(self):
320
		target = os.path.join('/var/www/univention-repository/%s/maintained/component' % self.ucs_version, '%s/all' % self.app_directory)
329
		target = os.path.join(
330
			REPO_DIR,
331
			self.ucs_version,
332
			'maintained/component',
333
			self.app_directory,
334
			'all',
335
		)
321
		os.makedirs(target)
336
		os.makedirs(target)
322
		shutil.copy(self.package.get_binary_name(), target)
337
		shutil.copy(self.package.get_binary_name(), target)
323
		subprocess.call('''
338
		subprocess.call('''
 Lines 353-363   class Appcenter: Link Here 
353
		self.ucr = UCSTestConfigRegistry()
368
		self.ucr = UCSTestConfigRegistry()
354
		self.ucr.load()
369
		self.ucr.load()
355
370
356
		if os.path.exists('/var/www/meta-inf'):
371
		if os.path.exists(META_INF):
357
			print 'ERROR: /var/www/meta-inf already exists'
372
			print 'ERROR: %s already exists' % META_INF
358
			raise AppcenterMetainfAlreadyExists()
373
			raise AppcenterMetainfAlreadyExists()
359
		if os.path.exists('/var/www/univention-repository'):
374
		if os.path.exists(REPO_DIR):
360
			print 'ERROR: /var/www/univention-repository already exists'
375
			print 'ERROR: %s already exists' % REPO_DIR
361
			raise AppcenterRepositoryAlreadyExists()
376
			raise AppcenterRepositoryAlreadyExists()
362
377
363
		if not version:
378
		if not version:
 Lines 366-388   class Appcenter: Link Here 
366
		self.add_ucs_version_to_appcenter(version)
381
		self.add_ucs_version_to_appcenter(version)
367
382
368
	def add_ucs_version_to_appcenter(self, version):
383
	def add_ucs_version_to_appcenter(self, version):
369
		if not os.path.exists('/var/www/meta-inf'):
384
		if not os.path.exists(META_INF):
370
			os.makedirs('/var/www/meta-inf', 0755)
385
			os.makedirs(META_INF, 0755)
371
			self.meta_inf_created = True
386
			self.meta_inf_created = True
372
387
373
		if not os.path.exists('/var/www/univention-repository'):
388
		if not os.path.exists(REPO_DIR):
374
			os.makedirs('/var/www/univention-repository', 0755)
389
			os.makedirs(REPO_DIR, 0755)
375
			self.univention_repository_created = True
390
			self.univention_repository_created = True
376
391
377
		os.makedirs('/var/www/univention-repository/%s/maintained/component' % version)
392
		os.makedirs(os.path.join(REPO_DIR, version, 'maintained/component'))
378
		os.makedirs('/var/www/meta-inf/%s' % version)
393
		os.makedirs(os.path.join(META_INF, version))
379
394
380
		if not os.path.exists('/var/www/meta-inf/categories.ini'):
395
		path = os.path.join(META_INF, 'categories.ini')
396
		if not os.path.exists(path):
381
			text = open(os.path.join(os.path.dirname(__file__), 'categories.ini'), 'r').read()
397
			text = open(os.path.join(os.path.dirname(__file__), 'categories.ini'), 'r').read()
382
			f = open('/var/www/meta-inf/categories.ini', 'w')
398
			f = open(path, 'w')
383
			f.write(test)
399
			f.write(test)
384
			f.close()
400
			f.close()
385
			f = open('/var/www/meta-inf/rating.ini', 'w')
401
			f = open(os.path.join(META_INF, 'rating.ini'), 'w')
386
			f.write('# rating stuff\n')
402
			f.write('# rating stuff\n')
387
			f.close()
403
			f.close()
388
404
 Lines 393-400   class Appcenter: Link Here 
393
		])
409
		])
394
410
395
	def update(self):
411
	def update(self):
396
		for vv in os.listdir('/var/www/meta-inf/'):
412
		for vv in os.listdir(META_INF):
397
			directory = os.path.join('/var/www/meta-inf/', vv)
413
			directory = os.path.join(META_INF, vv)
398
			if not os.path.isdir(directory):
414
			if not os.path.isdir(directory):
399
				continue
415
				continue
400
			print 'create_appcenter_json.py for %s' % vv
416
			print 'create_appcenter_json.py for %s' % vv
 Lines 403-417   class Appcenter: Link Here 
403
				'create_appcenter_json.py',
419
				'create_appcenter_json.py',
404
				'-u', vv,
420
				'-u', vv,
405
				'-d', '/var/www',
421
				'-d', '/var/www',
406
				'-o', '/var/www/meta-inf/%(version)s/index.json.gz' % var,
422
				'-o', os.path.join(META_INF, vv, 'index.json.gz'),
407
				'-s', 'http://%(fqdn)s' % var,
423
				'-s', 'http://%(fqdn)s' % var,
408
			))
424
			))
409
425
410
	def cleanup(self):
426
	def cleanup(self):
411
		if self.meta_inf_created:
427
		if self.meta_inf_created:
412
			shutil.rmtree('/var/www/meta-inf')
428
			shutil.rmtree(META_INF)
413
		if self.univention_repository_created:
429
		if self.univention_repository_created:
414
			shutil.rmtree('/var/www/univention-repository')
430
			shutil.rmtree(REPO_DIR)
415
		self.ucr.revert_to_original_registry()
431
		self.ucr.revert_to_original_registry()
416
432
417
	def __enter__(self):
433
	def __enter__(self):
418
- 
419
--
420
.../test/ucs-test/tests/80_docker/dockertest.py    | 37 ++++++++++------------
434
.../test/ucs-test/tests/80_docker/dockertest.py    | 37 ++++++++++------------
421
.../ucs-test/univention/testing/debian_package.py  |  5 ++-
435
.../ucs-test/univention/testing/debian_package.py  |  5 ++-
422
2 files changed, 18 insertions(+), 24 deletions(-)
436
2 files changed, 18 insertions(+), 24 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-21 / +16 lines)
 Lines 291-309   class App: Link Here 
291
			os.makedirs(path)
291
			os.makedirs(path)
292
292
293
		target = os.path.join(path, '%s.ini' % self.app_directory)
293
		target = os.path.join(path, '%s.ini' % self.app_directory)
294
		f = open(target, 'w')
294
		with open(target, 'w') as f:
295
		print 'Write ini file: %s' % target
295
			print 'Write ini file: %s' % target
296
		f.write('[Application]\n')
296
			f.write('[Application]\n')
297
		print '[Application]'
297
			print '[Application]'
298
		for key in self.ini.keys():
298
			for key in self.ini.keys():
299
			f.write('%s: %s\n' % (key, self.ini[key]))
299
				f.write('%s: %s\n' % (key, self.ini[key]))
300
			print '%s: %s' % (key, self.ini[key])
300
				print '%s: %s' % (key, self.ini[key])
301
		print
301
			print
302
		f.close()
303
		svg = os.path.join(path, self.ini.get('Logo'))
302
		svg = os.path.join(path, self.ini.get('Logo'))
304
		f = open(svg, 'w')
303
		with open(svg, 'w') as f:
305
		f.write(get_dummy_svg())
304
			f.write(get_dummy_svg())
306
		f.close()
307
305
308
	def _dump_scripts(self):
306
	def _dump_scripts(self):
309
		comp_path = os.path.join(
307
		comp_path = os.path.join(
 Lines 321-329   class App: Link Here 
321
			print 'Create %s' % target
319
			print 'Create %s' % target
322
			print self.scripts[script]
320
			print self.scripts[script]
323
321
324
			f = open(target, 'w')
322
			with open(target, 'w') as f:
325
			f.write(self.scripts[script])
323
				f.write(self.scripts[script])
326
			f.close()
327
324
328
	def _copy_package(self):
325
	def _copy_package(self):
329
		target = os.path.join(
326
		target = os.path.join(
 Lines 395-406   class Appcenter: Link Here 
395
		path = os.path.join(META_INF, 'categories.ini')
392
		path = os.path.join(META_INF, 'categories.ini')
396
		if not os.path.exists(path):
393
		if not os.path.exists(path):
397
			text = open(os.path.join(os.path.dirname(__file__), 'categories.ini'), 'r').read()
394
			text = open(os.path.join(os.path.dirname(__file__), 'categories.ini'), 'r').read()
398
			f = open(path, 'w')
395
			with open(path, 'w') as f:
399
			f.write(test)
396
				f.write(text)
400
			f.close()
397
			with open(os.path.join(META_INF, 'rating.ini'), 'w') as f:
401
			f = open(os.path.join(META_INF, 'rating.ini'), 'w')
398
				f.write('# rating stuff\n')
402
			f.write('# rating stuff\n')
403
			f.close()
404
399
405
		handler_set([
400
		handler_set([
406
			'update/secure_apt=no',
401
			'update/secure_apt=no',
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/univention/testing/debian_package.py (-5 / +2 lines)
 Lines 77-85   class DebianPackage(): Link Here 
77
		return deb_package
77
		return deb_package
78
78
79
	def __create_file_from_buffer(self, path, file_buffer, mode=None):
79
	def __create_file_from_buffer(self, path, file_buffer, mode=None):
80
		f = open(path, 'w')
80
		with open(path, 'w') as f:
81
		f.write(file_buffer)
81
			f.write(file_buffer)
82
		f.close()
83
		if mode:
82
		if mode:
84
			os.chmod(path, mode)
83
			os.chmod(path, mode)
85
84
86
- 
87
--
88
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py | 8 ++++----
85
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py | 8 ++++----
89
1 file changed, 4 insertions(+), 4 deletions(-)
86
1 file changed, 4 insertions(+), 4 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-6 / +4 lines)
 Lines 313-326   class App: Link Here 
313
		if not os.path.exists(comp_path):
313
		if not os.path.exists(comp_path):
314
			os.makedirs(comp_path)
314
			os.makedirs(comp_path)
315
315
316
		for script in self.scripts.keys():
316
		for name, script in self.scripts.iteritems():
317
			target = os.path.join(comp_path, script)
317
			target = os.path.join(comp_path, name)
318
318
319
			print 'Create %s' % target
319
			print 'Create %s' % target
320
			print self.scripts[script]
320
			print script
321
321
322
			with open(target, 'w') as f:
322
			with open(target, 'w') as f:
323
				f.write(self.scripts[script])
323
				f.write(script)
324
324
325
	def _copy_package(self):
325
	def _copy_package(self):
326
		target = os.path.join(
326
		target = os.path.join(
327
- 
328
--
329
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py  | 7 +++----
327
.../ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py  | 7 +++----
330
1 file changed, 3 insertions(+), 4 deletions(-)
328
1 file changed, 3 insertions(+), 4 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-0/test/ucs-test/tests/80_docker/dockertest.py (-5 / +3 lines)
 Lines 343-349   class App: Link Here 
343
		self.add_script(setup=setup % {'app_name': self.app_name})
343
		self.add_script(setup=setup % {'app_name': self.app_name})
344
344
345
	def verify_basic_modproxy_settings(self):
345
	def verify_basic_modproxy_settings(self):
346
		fqdn = '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
346
		fqdn = '%(hostname)s.%(domainname)s' % self.ucr
347
		test_string = 'TEST-%s\n' % self.app_name
347
		test_string = 'TEST-%s\n' % self.app_name
348
348
349
		response = urllib2.urlopen('http://%s/%s/index.txt' % (fqdn, self.app_name))
349
		response = urllib2.urlopen('http://%s/%s/index.txt' % (fqdn, self.app_name))
 Lines 400-406   class Appcenter: Link Here 
400
		handler_set([
400
		handler_set([
401
			'update/secure_apt=no',
401
			'update/secure_apt=no',
402
			'appcenter/index/verify=false',
402
			'appcenter/index/verify=false',
403
			'repository/app_center/server=%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])
403
			'repository/app_center/server=%(hostname)s.%(domainname)s' % self.ucr
404
		])
404
		])
405
405
406
	def update(self):
406
	def update(self):
 Lines 409-421   class Appcenter: Link Here 
409
			if not os.path.isdir(directory):
409
			if not os.path.isdir(directory):
410
				continue
410
				continue
411
			print 'create_appcenter_json.py for %s' % vv
411
			print 'create_appcenter_json.py for %s' % vv
412
			var = {'version': vv, 'fqdn': '%s.%s' % (self.ucr['hostname'], self.ucr['domainname'])}, shell=True)
413
			subprocess.call((
412
			subprocess.call((
414
				'create_appcenter_json.py',
413
				'create_appcenter_json.py',
415
				'-u', vv,
414
				'-u', vv,
416
				'-d', '/var/www',
415
				'-d', '/var/www',
417
				'-o', os.path.join(META_INF, vv, 'index.json.gz'),
416
				'-o', os.path.join(META_INF, vv, 'index.json.gz'),
418
				'-s', 'http://%(fqdn)s' % var,
417
				'-s', 'http://%(hostname)s.%(domainname)s' % self.ucr,
419
			))
418
			))
420
419
421
	def cleanup(self):
420
	def cleanup(self):
422
- 

Return to bug 40463