~plumgrid-team/charms/trusty/plumgrid-director/trunk

« back to all changes in this revision

Viewing changes to hooks/pg_dir_utils.py

  • Committer: bbaqar at plumgrid
  • Date: 2016-05-28 22:23:18 UTC
  • mfrom: (29.1.8 plumgrid-director)
  • Revision ID: bbaqar@plumgrid.com-20160528222318-0fgsim7dx9wbnllr
5.1 changes
- configure-pg-sources added
- updated templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
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'
88
89
])
89
90
 
90
91
 
 
92
def configure_pg_sources():
 
93
    '''
 
94
    Returns true if install sources is updated in sources.list file
 
95
    '''
 
96
    try:
 
97
        with open(SOURCES_LIST, 'r+') as sources:
 
98
            all_lines = sources.readlines()
 
99
            sources.seek(0)
 
100
            for i in (line for line in all_lines if "plumgrid" not in line):
 
101
                sources.write(i)
 
102
            sources.truncate()
 
103
        sources.close()
 
104
    except IOError:
 
105
        log('Unable to update /etc/apt/sources.list')
 
106
 
 
107
 
91
108
def determine_packages():
92
109
    '''
93
110
    Returns list of packages required by PLUMgrid director as specified