~ubuntu-branches/ubuntu/saucy/cloud-init/saucy-proposed

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_mounts.py

  • Committer: Scott Moser
  • Date: 2013-10-08 00:15:50 UTC
  • Revision ID: smoser@ubuntu.com-20131008001550-98r0dblzlpxfwdth
fix bug where a mount entry of 'ephemeral0' would only consider
the unpartitioned device, not also the first partition (LP: #1236594)

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
    if not os.path.exists(device):
223
223
        return None
224
224
 
225
 
    if not partition:
226
 
        return device
227
 
 
228
225
    short_name = os.path.basename(device)
229
226
    sys_path = "/sys/block/%s" % short_name
230
227
 
238
235
        partition = str(partition)
239
236
 
240
237
    if partition is None:
241
 
        valid_mappings = [sys_long_path + "1",
242
 
                          sys_long_path + "p1" % partition]
 
238
        valid_mappings = [sys_long_path + "1", sys_long_path + "p1"]
243
239
    elif partition != "0":
244
240
        valid_mappings = [sys_long_path + "%s" % partition,
245
241
                          sys_long_path + "p%s" % partition]