Fixes and cleanups.

This commit is contained in:
Alberto Donato 2015-11-02 17:50:00 +02:00
parent b9a656aa30
commit 80e9c5c6db
1 changed files with 11 additions and 6 deletions

View File

@ -52,7 +52,7 @@ def controller_api_joined(r_id=None):
@hooks.hook()
def install():
packages = PACKAGES.copy()
packages = PACKAGES[:]
install_origin = config["install-origin"]
if install_origin:
@ -61,7 +61,9 @@ def install():
apt_update(fatal=True)
# install packages
apt_install(PACKAGES, fatal=True)
apt_install(packages, fatal=True)
install_dir_name = "opendaylight-karaf"
if not install_origin:
# install opendaylight from tarball
@ -70,16 +72,19 @@ def install():
install_remote(install_url, dest="/opt")
# The extracted dirname. Look at what's on disk instead of mangling, so
# the distribution tar.gz's name doesn't matter.
name = [f for f in os.listdir("/opt")
if f.startswith("distribution-karaf")][0]
install_dir_name = [
f for f in os.listdir("/opt")
if f.startswith("distribution-karaf")][0]
if not os.path.exists("/opt/opendaylight-karaf"):
os.symlink(name, "/opt/opendaylight-karaf")
os.symlink(install_dir_name, "/opt/opendaylight-karaf")
shutil.copy("files/odl-controller.conf", "/etc/init")
adduser("opendaylight", system_user=True)
mkdir("/home/opendaylight", owner="opendaylight", group="opendaylight",
perms=0755)
check_call(["chown", "-R", "opendaylight:opendaylight", "/opt/" + name])
check_call(
["chown", "-R", "opendaylight:opendaylight",
os.path.join("/opt", install_dir_name)])
mkdir("/var/log/opendaylight", owner="opendaylight", group="opendaylight",
perms=0755)