Diff comments:

> diff --git a/cloudinit/sources/DataSourceOpenStack.py 
> b/cloudinit/sources/DataSourceOpenStack.py
> index 1a12a3f..1c803f4 100644
> --- a/cloudinit/sources/DataSourceOpenStack.py
> +++ b/cloudinit/sources/DataSourceOpenStack.py
> @@ -205,6 +212,20 @@ def read_metadata_service(base_url, ssl_details=None,
>      return reader.read_v2()
>  
>  
> +def detect_openstack():
> +    """Return True when a potential OpenStack platform is detected."""
> +    if not util.is_x86():
> +        return True  # Non-Intel cpus don't properly report dmi product names
> +    product_name = util.read_dmi_data('system-product-name')
> +    if product_name in (DMI_PRODUCT_NOVA, DMI_PRODUCT_COMPUTE):

I was hoping to have this tuple/list be defined as a constant, that way other 
users of this list can reference it from the DataSourceOpenStack module without 
knowing item to import.

VALID_DMI_PRODUCTS = [DMI_PRODUCT_NOVA, DMI_PRODUCT_COMPUTE]
VALID_DMI_CHASSIS_ASSET_TAGS = [DMI_ASSET_TAG_OPENTELEKOM]

Then these checks are product_name in VALID_DMI_PRODUCT, asset_tag in 
VALID_DMI_CHASSIS_ASSET_TAGS

> +        return True
> +    elif util.read_dmi_data('chassis-asset-tag') == 
> DMI_ASSET_TAG_OPENTELEKOM:
> +        return True
> +    elif util.get_proc_env(1).get('product_name') == DMI_PRODUCT_NOVA:
> +        return True
> +    return False
> +
> +
>  # Used to match classes to dependencies
>  datasources = [
>      (DataSourceOpenStackLocal, (sources.DEP_FILESYSTEM,)),


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/347937
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1776701-openstack-local-no-probe-on-ec2 into 
cloud-init:master.

_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to