Add install-origin option.
This commit is contained in:
parent
bf66e581d8
commit
b9a656aa30
|
@ -13,6 +13,15 @@ options:
|
|||
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"
|
||||
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:
|
||||
type: string
|
||||
default:
|
||||
|
|
|
@ -21,12 +21,14 @@ from charmhelpers.core.host import (
|
|||
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 PROFILES
|
||||
|
||||
PACKAGES = ["default-jre-headless", "python-jinja2"]
|
||||
KARAF_PACKAGE = "opendaylight-karaf"
|
||||
|
||||
hooks = Hooks()
|
||||
config = config()
|
||||
|
@ -50,20 +52,28 @@ def controller_api_joined(r_id=None):
|
|||
|
||||
@hooks.hook()
|
||||
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)
|
||||
|
||||
# install opendaylight
|
||||
install_url = config["install-url"]
|
||||
install_remote(install_url, dest="/opt") # this extracts the archive too
|
||||
|
||||
# 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]
|
||||
|
||||
if not os.path.exists("/opt/opendaylight-karaf"):
|
||||
os.symlink(name, "/opt/opendaylight-karaf")
|
||||
if not install_origin:
|
||||
# install opendaylight from tarball
|
||||
install_url = config["install-url"]
|
||||
# this extracts the archive too
|
||||
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]
|
||||
if not os.path.exists("/opt/opendaylight-karaf"):
|
||||
os.symlink(name, "/opt/opendaylight-karaf")
|
||||
|
||||
shutil.copy("files/odl-controller.conf", "/etc/init")
|
||||
adduser("opendaylight", system_user=True)
|
||||
|
|
Loading…
Reference in New Issue