Add install-origin option.
This commit is contained in:
parent
bf66e581d8
commit
b9a656aa30
|
@ -13,6 +13,15 @@ options:
|
||||||
type: string
|
type: string
|
||||||
default: "https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.2-Helium-SR2/distribution-karaf-0.2.2-Helium-SR2.tar.gz"
|
default: "https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.2-Helium-SR2/distribution-karaf-0.2.2-Helium-SR2.tar.gz"
|
||||||
description: Web addressable location of OpenDayLight binaries to install
|
description: Web addressable location of OpenDayLight binaries to install
|
||||||
|
install-origin:
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
description: |
|
||||||
|
Repository to install OpenDaylight binaries from. It can be a full APT
|
||||||
|
URL or a PPA.
|
||||||
|
|
||||||
|
If not specified, the package is installed from the URL specified by the
|
||||||
|
'install-url' option.
|
||||||
http-proxy:
|
http-proxy:
|
||||||
type: string
|
type: string
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -21,12 +21,14 @@ from charmhelpers.core.host import (
|
||||||
service_start
|
service_start
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.fetch import apt_install, install_remote
|
from charmhelpers.fetch import (
|
||||||
|
add_source, apt_update, apt_install, install_remote)
|
||||||
|
|
||||||
from odl_controller_utils import write_mvn_config, process_odl_cmds
|
from odl_controller_utils import write_mvn_config, process_odl_cmds
|
||||||
from odl_controller_utils import PROFILES
|
from odl_controller_utils import PROFILES
|
||||||
|
|
||||||
PACKAGES = ["default-jre-headless", "python-jinja2"]
|
PACKAGES = ["default-jre-headless", "python-jinja2"]
|
||||||
|
KARAF_PACKAGE = "opendaylight-karaf"
|
||||||
|
|
||||||
hooks = Hooks()
|
hooks = Hooks()
|
||||||
config = config()
|
config = config()
|
||||||
|
@ -50,20 +52,28 @@ def controller_api_joined(r_id=None):
|
||||||
|
|
||||||
@hooks.hook()
|
@hooks.hook()
|
||||||
def install():
|
def install():
|
||||||
# install dependencies
|
packages = PACKAGES.copy()
|
||||||
|
|
||||||
|
install_origin = config["install-origin"]
|
||||||
|
if install_origin:
|
||||||
|
add_source(install_origin)
|
||||||
|
packages.append(KARAF_PACKAGE)
|
||||||
|
apt_update(fatal=True)
|
||||||
|
|
||||||
|
# install packages
|
||||||
apt_install(PACKAGES, fatal=True)
|
apt_install(PACKAGES, fatal=True)
|
||||||
|
|
||||||
# install opendaylight
|
if not install_origin:
|
||||||
install_url = config["install-url"]
|
# install opendaylight from tarball
|
||||||
install_remote(install_url, dest="/opt") # this extracts the archive too
|
install_url = config["install-url"]
|
||||||
|
# this extracts the archive too
|
||||||
# The extracted dirname. Look at what's on disk instead of mangling, so
|
install_remote(install_url, dest="/opt")
|
||||||
# the distribution tar.gz's name doesn't matter.
|
# The extracted dirname. Look at what's on disk instead of mangling, so
|
||||||
name = [f for f in os.listdir("/opt")
|
# the distribution tar.gz's name doesn't matter.
|
||||||
if f.startswith("distribution-karaf")][0]
|
name = [f for f in os.listdir("/opt")
|
||||||
|
if f.startswith("distribution-karaf")][0]
|
||||||
if not os.path.exists("/opt/opendaylight-karaf"):
|
if not os.path.exists("/opt/opendaylight-karaf"):
|
||||||
os.symlink(name, "/opt/opendaylight-karaf")
|
os.symlink(name, "/opt/opendaylight-karaf")
|
||||||
|
|
||||||
shutil.copy("files/odl-controller.conf", "/etc/init")
|
shutil.copy("files/odl-controller.conf", "/etc/init")
|
||||||
adduser("opendaylight", system_user=True)
|
adduser("opendaylight", system_user=True)
|
||||||
|
|
Loading…
Reference in New Issue