Commit 6894b3c2 authored by Marco Mariani's avatar Marco Mariani

resource_stream -> resource_string

parent 4a7af070
...@@ -237,8 +237,8 @@ def slapserver(config): ...@@ -237,8 +237,8 @@ def slapserver(config):
print "Creating %r" % host_path print "Creating %r" % host_path
if not dry_run: if not dry_run:
open(host_path, 'w').write( open(host_path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'template/hosts.in').read() % { 'template/hosts.in') % {
'computer_id': config.computer_id 'computer_id': config.computer_id
}) })
...@@ -247,8 +247,8 @@ def slapserver(config): ...@@ -247,8 +247,8 @@ def slapserver(config):
print "Creating %r" % sshd_path print "Creating %r" % sshd_path
if not dry_run: if not dry_run:
open(sshd_path, 'w').write( open(sshd_path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'template/sshd_config.in').read()) 'template/sshd_config.in'))
os.chmod(sshd_path, 0o600) os.chmod(sshd_path, 0o600)
# Creating default bridge config # Creating default bridge config
...@@ -256,8 +256,8 @@ def slapserver(config): ...@@ -256,8 +256,8 @@ def slapserver(config):
print "Creating %r" % br0_path print "Creating %r" % br0_path
if not dry_run: if not dry_run:
open(br0_path, 'w').write( open(br0_path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'template/ifcfg-br0.in').read()) 'template/ifcfg-br0.in'))
# Creating default limits config # Creating default limits config
limits_conf_path = os.path.join(mount_dir_path, limits_conf_path = os.path.join(mount_dir_path,
...@@ -265,8 +265,8 @@ def slapserver(config): ...@@ -265,8 +265,8 @@ def slapserver(config):
print "Overriding %s" % limits_conf_path print "Overriding %s" % limits_conf_path
if not dry_run: if not dry_run:
open(limits_conf_path, 'w').write( open(limits_conf_path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'template/limits.conf.in').read()) 'template/limits.conf.in'))
# Writing ssh key # Writing ssh key
if config.need_ssh: if config.need_ssh:
...@@ -305,8 +305,8 @@ def slapserver(config): ...@@ -305,8 +305,8 @@ def slapserver(config):
path = os.path.join(mount_dir_path, 'etc', 'init.d', script) path = os.path.join(mount_dir_path, 'etc', 'init.d', script)
print "Creating %r" % path print "Creating %r" % path
if not dry_run: if not dry_run:
open(path, 'w').write(pkg_resources.resource_stream(__name__, open(path, 'w').write(pkg_resources.resource_string(__name__,
'script/%s' % script).read()) 'script/%s' % script))
os.chmod(path, 0o755) os.chmod(path, 0o755)
else: else:
for script in ['slapos_firstboot']: for script in ['slapos_firstboot']:
...@@ -345,8 +345,8 @@ def prepare_scripts(config): ...@@ -345,8 +345,8 @@ def prepare_scripts(config):
print "Creating %r" % path print "Creating %r" % path
if not dry_run: if not dry_run:
open(path, 'w').write( open(path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'script/slapos').read() % { 'script/slapos') % {
'slapos_configuration': slapos_configuration 'slapos_configuration': slapos_configuration
}) })
os.chmod(path, 0o755) os.chmod(path, 0o755)
...@@ -355,8 +355,8 @@ def prepare_scripts(config): ...@@ -355,8 +355,8 @@ def prepare_scripts(config):
print "Creating %r" % path print "Creating %r" % path
if not dry_run: if not dry_run:
open(path, 'w').write( open(path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'script/slapos.service').read() % { 'script/slapos.service') % {
'slapos_configuration': slapos_configuration 'slapos_configuration': slapos_configuration
}) })
os.chmod(path, 0o755) os.chmod(path, 0o755)
...@@ -366,8 +366,8 @@ def prepare_scripts(config): ...@@ -366,8 +366,8 @@ def prepare_scripts(config):
print "Creating %r" % path print "Creating %r" % path
if not dry_run: if not dry_run:
open(path, 'w').write( open(path, 'w').write(
pkg_resources.resource_stream(__name__, pkg_resources.resource_string(__name__,
'template/clientipv4.conf.in').read()) 'template/clientipv4.conf.in'))
os.chmod(path, 0o755) os.chmod(path, 0o755)
# Remove old-timers scripts # Remove old-timers scripts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment