Skip to content

Commit

Permalink
[ConnectedMachine] bug fix: add enable-auto-upgrade param back to ext…
Browse files Browse the repository at this point in the history
…ension update command (#4880)
  • Loading branch information
dorothyhu committed Jun 1, 2022
1 parent b430ec0 commit 33a77ae
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 176 deletions.
4 changes: 4 additions & 0 deletions src/connectedmachine/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.5.1
+++++
* Add enable-auto-upgrade param back into the extension upgrade command

0.5.0
+++++
* Upgrade the API version to stable/2022-03-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def connectedmachine_extension_update(client,
publisher=None,
type_=None,
type_handler_version=None,
enable_auto_upgrade=None,
auto_upgrade_minor=None,
settings=None,
protected_settings=None,
Expand All @@ -135,6 +136,8 @@ def connectedmachine_extension_update(client,
extension_parameters['properties']['type'] = type_
if type_handler_version is not None:
extension_parameters['properties']['type_handler_version'] = type_handler_version
if enable_auto_upgrade is not None:
extension_parameters['properties']['enable_automatic_upgrade'] = enable_auto_upgrade
if auto_upgrade_minor is not None:
extension_parameters['properties']['auto_upgrade_minor_version'] = auto_upgrade_minor
if settings is not None:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def test_machine_and_extension(test):
'--settings "{{\\"commandToExecute\\":\\"hostname\\"}}"',
checks=[
test.check('name', '{customScriptName}'),
test.check('properties.enableAutomaticUpgrade', True),
test.check('properties.typeHandlerVersion', '1.10.10'),
test.check('properties.settings.commandToExecute', 'hostname')
])
Expand Down Expand Up @@ -99,11 +100,13 @@ def test_machine_and_extension(test):

test.cmd('az connectedmachine extension update '
'--name "{customScriptName}" '
'--enable-auto-upgrade false '
'--settings "{{\\"commandToExecute\\":\\"dir\\"}}" '
'--machine-name "{machine}" '
'--resource-group "{rg}"',
checks=[
test.check('name', '{customScriptName}'),
test.check('properties.enableAutomaticUpgrade', False),
test.check('properties.provisioningState', 'Succeeded'),
test.check('properties.settings.commandToExecute', 'dir'),
test.check('properties.typeHandlerVersion', '1.10.12')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,10 @@ class MachineExtensionUpdateProperties(msrest.serialization.Model):
:param type: Specifies the type of the extension; an example is "CustomScriptExtension".
:type type: str
:param type_handler_version: Specifies the version of the script handler.
:type type_handler_version: str
:type type_handler_version: str
:param enable_automatic_upgrade: Indicates whether the extension should be automatically
upgraded by the platform if there is a newer version available.
:type enable_automatic_upgrade: bool
:param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor
version if one is available at deployment time. Once deployed, however, the extension will not
upgrade minor versions unless redeployed, even with this property set to true.
Expand All @@ -939,6 +942,7 @@ class MachineExtensionUpdateProperties(msrest.serialization.Model):
'publisher': {'key': 'publisher', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'},
'enable_automatic_upgrade': {'key': 'enableAutomaticUpgrade', 'type': 'bool'},
'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'},
'settings': {'key': 'settings', 'type': 'object'},
'protected_settings': {'key': 'protectedSettings', 'type': 'object'},
Expand All @@ -953,6 +957,7 @@ def __init__(
self.publisher = kwargs.get('publisher', None)
self.type = kwargs.get('type', None)
self.type_handler_version = kwargs.get('type_handler_version', None)
self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None)
self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None)
self.settings = kwargs.get('settings', None)
self.protected_settings = kwargs.get('protected_settings', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,9 @@ class MachineExtensionUpdateProperties(msrest.serialization.Model):
:type type: str
:param type_handler_version: Specifies the version of the script handler.
:type type_handler_version: str
:param enable_automatic_upgrade: Indicates whether the extension should be automatically
upgraded by the platform if there is a newer version available.
:type enable_automatic_upgrade: bool
:param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor
version if one is available at deployment time. Once deployed, however, the extension will not
upgrade minor versions unless redeployed, even with this property set to true.
Expand All @@ -1006,6 +1009,7 @@ class MachineExtensionUpdateProperties(msrest.serialization.Model):
'publisher': {'key': 'publisher', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'},
'enable_automatic_upgrade': {'key': 'enableAutomaticUpgrade', 'type': 'bool'},
'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'},
'settings': {'key': 'settings', 'type': 'object'},
'protected_settings': {'key': 'protectedSettings', 'type': 'object'},
Expand All @@ -1018,6 +1022,7 @@ def __init__(
publisher: Optional[str] = None,
type: Optional[str] = None,
type_handler_version: Optional[str] = None,
enable_automatic_upgrade: Optional[bool] = None,
auto_upgrade_minor_version: Optional[bool] = None,
settings: Optional[object] = None,
protected_settings: Optional[object] = None,
Expand All @@ -1028,6 +1033,7 @@ def __init__(
self.publisher = publisher
self.type = type
self.type_handler_version = type_handler_version
self.enable_automatic_upgrade = enable_automatic_upgrade
self.auto_upgrade_minor_version = auto_upgrade_minor_version
self.settings = settings
self.protected_settings = protected_settings
Expand Down
1 change: 1 addition & 0 deletions src/connectedmachine/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ $_.CPU -lt 100 }\\\\\\"\\"}" --type-handler-version "1.10" --machine-name "myMac
|**--publisher**|string|The name of the extension handler publisher.|publisher|publisher|
|**--type**|string|Specifies the type of the extension; an example is "CustomScriptExtension".|type|type|
|**--type-handler-version**|string|Specifies the version of the script handler.|type_handler_version|typeHandlerVersion|
|**--enable-auto-upgrade**|boolean|Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.|enable_auto_upgrade|enableAutomaticUpgrade|
|**--auto-upgrade-minor**|boolean|Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.|auto_upgrade_minor|autoUpgradeMinorVersion|
|**--settings**|any|Json formatted public settings for the extension.|settings|settings|
|**--protected-settings**|any|The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.|protected_settings|protectedSettings|
Expand Down
2 changes: 1 addition & 1 deletion src/connectedmachine/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup, find_packages

# HISTORY.rst entry.
VERSION = '0.5.0'
VERSION = '0.5.1'
try:
from azext_connectedmachine.manual.version import VERSION
except ImportError:
Expand Down

0 comments on commit 33a77ae

Please sign in to comment.