Browse Source

5.1 changes

- configure-pg-sources added
- updated templates
Bilal Baqar 3 years ago
parent
commit
03c379164b

+ 4
- 1
hooks/pg_gw_hooks.py View File

@@ -34,7 +34,8 @@ from pg_gw_utils import (
34 34
     load_iptables,
35 35
     restart_on_change,
36 36
     restart_on_stop,
37
-    director_cluster_ready
37
+    director_cluster_ready,
38
+    configure_pg_sources
38 39
 )
39 40
 
40 41
 hooks = Hooks()
@@ -92,6 +93,8 @@ def config_changed():
92 93
             charm_config.changed('iovisor-build')):
93 94
         stop_pg()
94 95
         status_set('maintenance', 'Upgrading apt packages')
96
+        if charm_config.changed('install_sources'):
97
+            configure_pg_sources()
95 98
         configure_sources(update=True)
96 99
         pkgs = determine_packages()
97 100
         for pkg in pkgs:

+ 17
- 0
hooks/pg_gw_utils.py View File

@@ -42,6 +42,7 @@ from charmhelpers.contrib.openstack.utils import (
42 42
     os_release,
43 43
 )
44 44
 
45
+SOURCES_LIST = '/etc/apt/sources.list'
45 46
 LXC_CONF = "/etc/libvirt/lxc.conf"
46 47
 TEMPLATES = 'templates/'
47 48
 PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data'
@@ -78,6 +79,22 @@ BASE_RESOURCE_MAP = OrderedDict([
78 79
 ])
79 80
 
80 81
 
82
+def configure_pg_sources():
83
+    '''
84
+    Returns true if install sources is updated in sources.list file
85
+    '''
86
+    try:
87
+        with open(SOURCES_LIST, 'r+') as sources:
88
+            all_lines = sources.readlines()
89
+            sources.seek(0)
90
+            for i in (line for line in all_lines if "plumgrid" not in line):
91
+                sources.write(i)
92
+            sources.truncate()
93
+        sources.close()
94
+    except IOError:
95
+        log('Unable to update /etc/apt/sources.list')
96
+
97
+
81 98
 def determine_packages():
82 99
     '''
83 100
     Returns list of packages required by PLUMgrid Gateway as specified

+ 2
- 1
templates/kilo/00-pg.conf View File

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

+ 2
- 2
templates/kilo/ifcs.conf View File

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

+ 3
- 0
templates/kilo/plumgrid.conf View File

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

Loading…
Cancel
Save