~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/common/glance_service/base_image_service.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-01-05 12:21:37 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20150105122137-171bqrdpcxqipunk
Tags: 2015.1~b1-0ubuntu1
* New upstream beta release:
  - d/control: Align version requirements with upstream release.
* d/watch: Update uversionmangle to deal with kilo beta versioning
  changes.
* d/control: Bumped Standards-Version to 3.9.6, no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import sys
22
22
import time
23
23
 
 
24
from glanceclient import client
 
25
from oslo.config import cfg
24
26
import sendfile
25
 
 
26
 
from glanceclient import client
27
27
import six.moves.urllib.parse as urlparse
28
28
 
29
29
from ironic.common import exception
30
30
from ironic.common.glance_service import service_utils
31
31
from ironic.common.i18n import _LE
32
32
 
33
 
from oslo.config import cfg
34
 
 
35
33
 
36
34
LOG = logging.getLogger(__name__)
37
35
CONF = cfg.CONF
63
61
    """Creates a glance client if doesn't exists and calls the function."""
64
62
    @functools.wraps(func)
65
63
    def wrapper(self, *args, **kwargs):
66
 
        """wrapper around methods calls
 
64
        """Wrapper around methods calls.
 
65
 
67
66
        :param image_href: href that describes the location of an image
68
67
        """
69
68
 
98
97
 
99
98
    def call(self, method, *args, **kwargs):
100
99
        """Call a glance client method.
 
100
 
101
101
        If we get a connection error,
102
102
        retry the request according to CONF.glance_num_retries.
103
103
 
205
205
        (image_id, self.glance_host,
206
206
         self.glance_port, use_ssl) = service_utils.parse_image_ref(image_id)
207
207
 
208
 
        if self.version == 2 \
209
 
                and 'file' in CONF.glance.allowed_direct_url_schemes:
 
208
        if (self.version == 2 and
 
209
                'file' in CONF.glance.allowed_direct_url_schemes):
210
210
 
211
211
            location = self._get_location(image_id)
212
212
            url = urlparse.urlparse(location)
234
234
        """
235
235
        sent_service_image_meta = service_utils.translate_to_glance(image_meta)
236
236
 
237
 
        #TODO(ghe): Allow copy-from or location headers Bug #1199532
 
237
        # TODO(ghe): Allow copy-from or location headers Bug #1199532
238
238
 
239
239
        if data:
240
240
            sent_service_image_meta['data'] = data
265
265
            if data:
266
266
                image_meta['data'] = data
267
267
 
268
 
        #NOTE(bcwaldon): id is not an editable field, but it is likely to be
 
268
        # NOTE(bcwaldon): id is not an editable field, but it is likely to be
269
269
        # passed in by calling code. Let's be nice and ignore it.
270
270
        image_meta.pop('id', None)
271
271