AzureInstancePlan

This parser reads the output of a command curl -s -H Metadata:true http://169.254.169.254/metadata/instance/compute/plan?api-version=2018-10-01&format=json, which is used to check whether the instance is a marketplace image.

For more details, See: https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#plan

class insights.parsers.azure_instance_plan.AzureInstancePlan(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

Class for parsing the Azure Instance Plan returned by command curl -s -H Metadata:true http://169.254.169.254/metadata/instance/compute/plan?api-version=2018-10-01&format=json,

Typical Output of this command is:

{
    "name": "planName",
    "product": "planProduct",
    "publisher": "planPublisher"
},
Raises

SkipException -- When content is empty or no parse-able content.

name

The name of the plan for the VM Instance in Azure, e.g: rhel7

Type

str

product

The product of the plan for the VM Instance in Azure, e.g: RHEL

Type

str

publisher

The publisher of the plan for the VM Instance in Azure, e.g: Red hat

Type

str

raw

The full JSON of the plan returned by the curl command

Type

str

Examples

>>> azure_plan.name == 'planName'
True
>>> azure_plan.product == 'planProduct'
True
>>> azure_plan.publisher == 'planPublisher'
True
parse_content(content)[source]

This method must be implemented by classes based on this class.