Configured plumgrid install sources
This commit is contained in:
commit
d583e39a08
@ -32,6 +32,7 @@ from neutron_plumgrid_utils import (
|
|||||||
restart_map,
|
restart_map,
|
||||||
ensure_files,
|
ensure_files,
|
||||||
set_neutron_relation,
|
set_neutron_relation,
|
||||||
|
configure_pg_sources
|
||||||
)
|
)
|
||||||
|
|
||||||
hooks = Hooks()
|
hooks = Hooks()
|
||||||
@ -65,6 +66,9 @@ def config_changed():
|
|||||||
charm_config.changed('plumgrid-build') or
|
charm_config.changed('plumgrid-build') or
|
||||||
charm_config.changed('install_keys')):
|
charm_config.changed('install_keys')):
|
||||||
status_set('maintenance', 'Upgrading apt packages')
|
status_set('maintenance', 'Upgrading apt packages')
|
||||||
|
if charm_config.changed('install_sources'):
|
||||||
|
if not configure_pg_sources():
|
||||||
|
log('IOError: /etc/apt/sources.list couldn\'t be updated')
|
||||||
configure_sources()
|
configure_sources()
|
||||||
apt_update()
|
apt_update()
|
||||||
pkgs = determine_packages()
|
pkgs = determine_packages()
|
||||||
|
@ -31,7 +31,7 @@ PG_PACKAGES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||||
|
SOURCES_LIST = '/etc/apt/sources.list'
|
||||||
SU_FILE = '/etc/sudoers.d/neutron_sudoers'
|
SU_FILE = '/etc/sudoers.d/neutron_sudoers'
|
||||||
PLUMGRID_CONF = '%s/plugins/plumgrid/plumgrid.ini' % NEUTRON_CONF_DIR
|
PLUMGRID_CONF = '%s/plugins/plumgrid/plumgrid.ini' % NEUTRON_CONF_DIR
|
||||||
PGLIB_CONF = '%s/plugins/plumgrid/plumlib.ini' % NEUTRON_CONF_DIR
|
PGLIB_CONF = '%s/plugins/plumgrid/plumlib.ini' % NEUTRON_CONF_DIR
|
||||||
@ -63,6 +63,23 @@ NETWORKING_PLUMGRID_VERSION = OrderedDict([
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def configure_pg_sources():
|
||||||
|
'''
|
||||||
|
Returns true if install sources is updated in sources.list file
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
with open(SOURCES_LIST, 'r+') as sources:
|
||||||
|
all_lines = sources.readlines()
|
||||||
|
sources.seek(0)
|
||||||
|
for i in (line for line in all_lines if "plumgrid" not in line):
|
||||||
|
sources.write(i)
|
||||||
|
sources.truncate()
|
||||||
|
sources.close()
|
||||||
|
return True
|
||||||
|
except IOError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def determine_packages():
|
def determine_packages():
|
||||||
'''
|
'''
|
||||||
Returns list of packages required to be installed alongside neutron to
|
Returns list of packages required to be installed alongside neutron to
|
||||||
|
Loading…
Reference in New Issue
Block a user