~junaidali/charms/trusty/plumgrid-edge/docker-oil

« back to all changes in this revision

Viewing changes to hooks/pg_edge_utils.py

  • Committer: Bilal Baqar
  • Date: 2015-10-06 16:24:42 UTC
  • mfrom: (15.1.1 plumgrid-edge)
  • Revision ID: bbaqar@plumgrid.com-20151006162442-0xpcq186o3diehw2
Merge: Version specific install of packages enabled

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    service_start,
21
21
    service_stop,
22
22
)
 
23
from charmhelpers.fetch import (
 
24
    apt_cache
 
25
)
23
26
from charmhelpers.contrib.storage.linux.ceph import modprobe
24
27
from charmhelpers.core.host import set_nic_mtu
25
28
from charmhelpers.fetch import apt_install
77
80
    Returns list of packages required by PLUMgrid Edge as specified
78
81
    in the neutron_plugins dictionary in charmhelpers.
79
82
    '''
80
 
    return neutron_plugin_attribute('plumgrid', 'packages', 'neutron')
 
83
    pkgs = []
 
84
    tag = 'latest'
 
85
    for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'):
 
86
        if 'plumgrid' in pkg:
 
87
            tag = config('plumgrid-build')
 
88
        elif pkg == 'iovisor-dkms':
 
89
            tag = config('iovisor-build')
 
90
 
 
91
        if tag == 'latest':
 
92
            pkgs.append(pkg)
 
93
        else:
 
94
            if tag in [i.ver_str for i in apt_cache()[pkg].version_list]:
 
95
                pkgs.append('%s=%s' % (pkg, tag))
 
96
            else:
 
97
                error_msg = \
 
98
                    "Build version '%s' for package '%s' not available" \
 
99
                    % (tag, pkg)
 
100
                raise ValueError(error_msg)
 
101
    return pkgs
81
102
 
82
103
 
83
104
def register_configs(release=None):