Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
"""Runs the specified PowerShell on the VM (Windows). Corresponds to Packer
powershell provisioner.
powershell provisioner. Exactly one of 'script' or 'inline' can be
specified.

All required parameters must be populated in order to send to Azure.

Expand All @@ -26,7 +27,10 @@ class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
:param script: The PowerShell script to be run for customizing. It can be
a github link, SAS URI for Azure Storage, etc
:type script: str
:param valid_exit_codes:
:param inline: Array of PowerShell commands to execute
:type inline: list[str]
:param valid_exit_codes: Valid exit codes for the PowerShell script.
[Default: 0]
:type valid_exit_codes: list[int]
"""

Expand All @@ -38,11 +42,13 @@ class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script': {'key': 'script', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
'valid_exit_codes': {'key': 'validExitCodes', 'type': '[int]'},
}

def __init__(self, **kwargs):
super(ImageTemplatePowerShellCustomizer, self).__init__(**kwargs)
self.script = kwargs.get('script', None)
self.inline = kwargs.get('inline', None)
self.valid_exit_codes = kwargs.get('valid_exit_codes', None)
self.type = 'PowerShell'
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
"""Runs the specified PowerShell on the VM (Windows). Corresponds to Packer
powershell provisioner.
powershell provisioner. Exactly one of 'script' or 'inline' can be
specified.

All required parameters must be populated in order to send to Azure.

Expand All @@ -26,7 +27,10 @@ class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
:param script: The PowerShell script to be run for customizing. It can be
a github link, SAS URI for Azure Storage, etc
:type script: str
:param valid_exit_codes:
:param inline: Array of PowerShell commands to execute
:type inline: list[str]
:param valid_exit_codes: Valid exit codes for the PowerShell script.
[Default: 0]
:type valid_exit_codes: list[int]
"""

Expand All @@ -38,11 +42,13 @@ class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script': {'key': 'script', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
'valid_exit_codes': {'key': 'validExitCodes', 'type': '[int]'},
}

def __init__(self, *, name: str=None, script: str=None, valid_exit_codes=None, **kwargs) -> None:
def __init__(self, *, name: str=None, script: str=None, inline=None, valid_exit_codes=None, **kwargs) -> None:
super(ImageTemplatePowerShellCustomizer, self).__init__(name=name, **kwargs)
self.script = script
self.inline = inline
self.valid_exit_codes = valid_exit_codes
self.type = 'PowerShell'
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@


class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
"""Runs a shell script during the customization phase (Linux).
"""Runs a shell script during the customization phase (Linux). Corresponds to
Packer shell provisioner. Exactly one of 'script' or 'inline' can be
specified.

All required parameters must be populated in order to send to Azure.

Expand All @@ -25,6 +27,8 @@ class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
:param script: The shell script to be run for customizing. It can be a
github link, SAS URI for Azure Storage, etc
:type script: str
:param inline: Array of shell commands to execute
:type inline: list[str]
"""

_validation = {
Expand All @@ -35,9 +39,11 @@ class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script': {'key': 'script', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
}

def __init__(self, **kwargs):
super(ImageTemplateShellCustomizer, self).__init__(**kwargs)
self.script = kwargs.get('script', None)
self.inline = kwargs.get('inline', None)
self.type = 'Shell'
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@


class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
"""Runs a shell script during the customization phase (Linux).
"""Runs a shell script during the customization phase (Linux). Corresponds to
Packer shell provisioner. Exactly one of 'script' or 'inline' can be
specified.

All required parameters must be populated in order to send to Azure.

Expand All @@ -25,6 +27,8 @@ class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
:param script: The shell script to be run for customizing. It can be a
github link, SAS URI for Azure Storage, etc
:type script: str
:param inline: Array of shell commands to execute
:type inline: list[str]
"""

_validation = {
Expand All @@ -35,9 +39,11 @@ class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script': {'key': 'script', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
}

def __init__(self, *, name: str=None, script: str=None, **kwargs) -> None:
def __init__(self, *, name: str=None, script: str=None, inline=None, **kwargs) -> None:
super(ImageTemplateShellCustomizer, self).__init__(name=name, **kwargs)
self.script = script
self.inline = inline
self.type = 'Shell'
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class RunOutput(SubResource):
:vartype type: str
:param artifact_id: The resource id of the artifact.
:type artifact_id: str
:param artifact_location: The URL location of the artifact.
:type artifact_location: str
:param artifact_uri: The location URI of the artifact.
:type artifact_uri: str
:ivar provisioning_state: Provisioning state of the resource. Possible
values include: 'Creating', 'Succeeded', 'Failed', 'Deleting'
:vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.enum
Expand All @@ -47,12 +47,12 @@ class RunOutput(SubResource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'artifact_id': {'key': 'properties.artifactId', 'type': 'str'},
'artifact_location': {'key': 'properties.artifactLocation', 'type': 'str'},
'artifact_uri': {'key': 'properties.artifactUri', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}

def __init__(self, **kwargs):
super(RunOutput, self).__init__(**kwargs)
self.artifact_id = kwargs.get('artifact_id', None)
self.artifact_location = kwargs.get('artifact_location', None)
self.artifact_uri = kwargs.get('artifact_uri', None)
self.provisioning_state = None
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class RunOutput(SubResource):
:vartype type: str
:param artifact_id: The resource id of the artifact.
:type artifact_id: str
:param artifact_location: The URL location of the artifact.
:type artifact_location: str
:param artifact_uri: The location URI of the artifact.
:type artifact_uri: str
:ivar provisioning_state: Provisioning state of the resource. Possible
values include: 'Creating', 'Succeeded', 'Failed', 'Deleting'
:vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.enum
Expand All @@ -47,12 +47,12 @@ class RunOutput(SubResource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'artifact_id': {'key': 'properties.artifactId', 'type': 'str'},
'artifact_location': {'key': 'properties.artifactLocation', 'type': 'str'},
'artifact_uri': {'key': 'properties.artifactUri', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}

def __init__(self, *, name: str, artifact_id: str=None, artifact_location: str=None, **kwargs) -> None:
def __init__(self, *, name: str, artifact_id: str=None, artifact_uri: str=None, **kwargs) -> None:
super(RunOutput, self).__init__(name=name, **kwargs)
self.artifact_id = artifact_id
self.artifact_location = artifact_location
self.artifact_uri = artifact_uri
self.provisioning_state = None