~openstack-charmers-archive/charms/trusty/neutron-api/next

« back to all changes in this revision

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

  • Committer: james.page at ubuntu
  • Date: 2014-12-15 09:14:03 UTC
  • mfrom: (63.1.8 neutron-api)
  • Revision ID: james.page@ubuntu.com-20141215091403-af7ic1lxnnjsh4zu
[corey.bryant,r=james-page] Sort out charmhelpers issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    # sometimes sgdisk exits non-zero; this is OK, dd will clean up
31
31
    call(['sgdisk', '--zap-all', '--mbrtogpt',
32
32
          '--clear', block_device])
33
 
    dev_end = check_output(['blockdev', '--getsz', block_device])
 
33
    dev_end = check_output(['blockdev', '--getsz',
 
34
                            block_device]).decode('UTF-8')
34
35
    gpt_end = int(dev_end.split()[0]) - 100
35
36
    check_call(['dd', 'if=/dev/zero', 'of=%s' % (block_device),
36
37
                'bs=1M', 'count=1'])
47
48
        it doesn't.
48
49
    '''
49
50
    is_partition = bool(re.search(r".*[0-9]+\b", device))
50
 
    out = check_output(['mount'])
 
51
    out = check_output(['mount']).decode('UTF-8')
51
52
    if is_partition:
52
53
        return bool(re.search(device + r"\b", out))
53
54
    return bool(re.search(device + r"[0-9]+\b", out))