Merge ~smoser/cloud-init:oracle-block-device-mapping into cloud-init:master

Proposed by Scott Moser
Status: Merged
Merged at revision: 847fda8353759e6eddee5a7478c9078b617a7837
Proposed branch: ~smoser/cloud-init:oracle-block-device-mapping
Merge into: cloud-init:master
Diff against target: 15 lines (+4/-0)
1 file modified
cloudinit/sources/DataSourceEc2.py (+4/-0)
Reviewer Review Type Date Requested Status
Ryan Harper Approve
Review via email: mp+310371@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

when you provide it you can give a list of dicts... in the metadata service it must come back as a dictionary (the code we have does items() on it, so it can't be a list).

see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html

the way we crawl turns the 'block-device-mapping/' directory into a dictionary.

Revision history for this message
Ryan Harper (raharper) wrote :

On Tue, Nov 8, 2016 at 3:43 PM, Scott Moser <email address hidden> wrote:

> when you provide it you can give a list of dicts... in the metadata
> service it must come back as a dictionary (the code we have does items() on
> it, so it can't be a list).
>
> see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-
> instance-metadata.html
>
> the way we crawl turns the 'block-device-mapping/' directory into a
> dictionary.
>

Ok, that makes sense, the "list" is the directory, and each entry is a dict
of config.

Approve.

>
>
> --
> https://code.launchpad.net/~smoser/cloud-init/+git/cloud-
> init/+merge/310371
> Your team cloud init development team is requested to review the proposed
> merge of ~smoser/cloud-init:oracle-block-device-mapping into
> cloud-init:master.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~cloud-init-dev
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~cloud-init-dev
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Ryan Harper (raharper) :
review: Approve

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
2index bc84ef5..bb6d6fd 100644
3--- a/cloudinit/sources/DataSourceEc2.py
4+++ b/cloudinit/sources/DataSourceEc2.py
5@@ -151,6 +151,10 @@ class DataSourceEc2(sources.DataSource):
6 # 'root': '/dev/sda1'}
7 found = None
8 bdm = self.metadata['block-device-mapping']
9+ if not isinstance(bdm, dict):
10+ LOG.debug("block-device-mapping not a dictionary: '%s'", bdm)
11+ return None
12+
13 for (entname, device) in bdm.items():
14 if entname == name:
15 found = device

Subscribers

People subscribed via source and target branches