~lutostag/ubuntu/trusty/maas/1.5.2+packagefix

« back to all changes in this revision

Viewing changes to src/provisioningserver/boot_images.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2014-03-28 10:43:53 UTC
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20140328104353-ekpolg0pm5xnvq2s
Tags: upstream-1.5+bzr2204
ImportĀ upstreamĀ versionĀ 1.5+bzr2204

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
 
"""Dealing with boot images.
5
 
 
6
 
Most of the lower-level logic is in the `tftppath` module, because it must
7
 
correspond closely to the structure of the TFTP filesystem hierarchy.
8
 
"""
 
4
"""Dealing with boot images."""
9
5
 
10
6
from __future__ import (
11
7
    absolute_import,
29
25
    MAASOAuth,
30
26
    )
31
27
from provisioningserver.auth import get_recorded_api_credentials
 
28
from provisioningserver.boot import tftppath
32
29
from provisioningserver.cluster_config import (
33
30
    get_cluster_uuid,
34
31
    get_maas_url,
35
32
    )
36
 
from provisioningserver.config import Config
37
 
from provisioningserver.pxe import tftppath
 
33
from provisioningserver.config import BootConfig
38
34
 
39
35
 
40
36
logger = getLogger(__name__)
57
53
 
58
54
def submit(maas_url, api_credentials, images):
59
55
    """Submit images to server."""
 
56
    path = 'api/1.0/nodegroups/%s/boot-images/' % get_cluster_uuid()
60
57
    MAASClient(MAASOAuth(*api_credentials), MAASDispatcher(), maas_url).post(
61
 
        'api/1.0/boot-images/', 'report_boot_images',
62
 
        nodegroup=get_cluster_uuid(), images=json.dumps(images))
 
58
        path=path, op='report_boot_images', images=json.dumps(images))
63
59
 
64
60
 
65
61
def report_to_server():
69
65
        return
70
66
 
71
67
    images = tftppath.list_boot_images(
72
 
        Config.load_from_cache()['tftp']['root'])
 
68
        BootConfig.load_from_cache()['boot']['storage'] + '/current/')
73
69
 
74
70
    submit(maas_url, api_credentials, images)