~pwlars/lava-test/dashboard-format-1.2

« back to all changes in this revision

Viewing changes to abrek/swprofile.py

  • Committer: Paul Larson
  • Date: 2011-04-07 05:26:43 UTC
  • Revision ID: paul.larson@canonical.com-20110407052643-kpiuds1fuhd36hq2
Update abrek dashboard bundle format to 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
            packages.append(pkg)
36
36
    return packages
37
37
 
38
 
def get_sw_context(apt_cache=None, lsb_information=None):
39
 
    """ Return dict used for storing sw_context information
 
38
def get_software_context(apt_cache=None, lsb_information=None):
 
39
    """ Return dict used for storing software_context information
40
40
 
41
41
    test_id - Unique identifier for this test
42
42
    time_check - whether or not a check was performed to see if
44
44
    apt_cache - if not provided, this will be read from the system
45
45
    lsb_information - if not provided, this will be read from the system
46
46
    """
47
 
    sw_context = {}
48
 
    sw_context['sw_image'] = get_sw_image(lsb_information)
49
 
    sw_context['packages'] = get_packages(apt_cache)
50
 
    return sw_context
 
47
    software_context = {}
 
48
    software_context['image'] = get_image(lsb_information)
 
49
    software_context['packages'] = get_packages(apt_cache)
 
50
    return software_context
51
51
 
52
 
def get_sw_image(lsb_information=None):
 
52
def get_image(lsb_information=None):
53
53
    """ Get information about the image we are running
54
54
 
55
 
    If /etc/buildstamp exists, get the sw_image id from that.  Otherwise
 
55
    If /etc/buildstamp exists, get the image id from that.  Otherwise
56
56
    just use the lsb-release description for a rough idea.
57
57
    """
58
58
    try:
59
59
        buildstamp = read_file("/etc/buildstamp")
60
 
        desc = buildstamp.splitlines()[1]
 
60
        name = buildstamp.splitlines()[1]
61
61
    except IOError:
62
62
        if lsb_information == None:
63
63
            lsb_information = lsb_release.get_lsb_information()
64
 
        desc = lsb_information['DESCRIPTION']
65
 
    return {"desc":desc}
 
64
        name = lsb_information['DESCRIPTION']
 
65
    return {"name":name}