~hopem/charms/trusty/cinder/ensure-apache-restart

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/storage/linux/loopback.py

  • Committer: Liam Young
  • Date: 2015-01-09 16:02:39 UTC
  • mfrom: (65 cinder.next)
  • mto: This revision was merged to the branch mainline in revision 67.
  • Revision ID: liam.young@canonical.com-20150109160239-qldk423wxfno2ao3
Merged next in and resolved conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
import os
3
2
import re
4
 
 
5
3
from subprocess import (
6
4
    check_call,
7
5
    check_output,
8
6
)
9
7
 
 
8
import six
 
9
 
10
10
 
11
11
##################################################
12
12
# loopback device helpers.
37
37
    '''
38
38
    file_path = os.path.abspath(file_path)
39
39
    check_call(['losetup', '--find', file_path])
40
 
    for d, f in loopback_devices().iteritems():
 
40
    for d, f in six.iteritems(loopback_devices()):
41
41
        if f == file_path:
42
42
            return d
43
43
 
51
51
 
52
52
    :returns: str: Full path to the ensured loopback device (eg, /dev/loop0)
53
53
    '''
54
 
    for d, f in loopback_devices().iteritems():
 
54
    for d, f in six.iteritems(loopback_devices()):
55
55
        if f == path:
56
56
            return d
57
57