Updated template files
  Configured plumgrid install sources
This commit is contained in:
Junaid Ali 2016-05-21 16:54:18 +05:00
parent 174d5da3e8
commit 561ee23925
5 changed files with 30 additions and 4 deletions

View File

@ -34,7 +34,8 @@ from pg_gw_utils import (
load_iptables,
restart_on_change,
restart_on_stop,
director_cluster_ready
director_cluster_ready,
configure_pg_sources
)
hooks = Hooks()
@ -92,6 +93,9 @@ def config_changed():
charm_config.changed('iovisor-build')):
stop_pg()
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(update=True)
pkgs = determine_packages()
for pkg in pkgs:

View File

@ -42,6 +42,7 @@ from charmhelpers.contrib.openstack.utils import (
os_release,
)
SOURCES_LIST = '/etc/apt/sources.list'
LXC_CONF = "/etc/libvirt/lxc.conf"
TEMPLATES = 'templates/'
PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data'
@ -78,6 +79,23 @@ BASE_RESOURCE_MAP = 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():
'''
Returns list of packages required by PLUMgrid Gateway as specified

View File

@ -1,2 +1,3 @@
$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}"
:syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json
if $syslogtag == 'pg:' and not ($msg contains 'dht_cli_') then @{{ opsvm_ip }}:6000;ls_json
:msg, contains, "VM Interface Stats" ~

View File

@ -1,7 +1,7 @@
{{ fabric_interface }} = fabric_core host
{% if ext_interfaces -%}
{% for ip in ext_interfaces -%}
{{ ip }} = access_phys
{% for dev in ext_interfaces -%}
{{ dev }} = access_phys
{% endfor -%}
{% endif -%}

View File

@ -5,6 +5,9 @@ label={{ label}}
plumgrid_rsync_port=2222
plumgrid_rest_addr=0.0.0.0:9180
fabric_mode={{ fabric_mode }}
plumgrid_syslog_ng_ip={{ plumgrid_syslog_ng_ip }}
plumgrid_syslog_ng_port={{ plumgrid_syslog_ng_port }}
plumgrid_monitor_interval={{ plumgrid_monitor_interval }}
start_plumgrid_iovisor=yes
start_plumgrid=`/opt/pg/scripts/pg_is_director.sh $plumgrid_ip`
location=