Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

fix invalid custom generated issue #864

Merged
merged 4 commits into from
Jul 21, 2021

Conversation

kairu-ms
Copy link
Contributor

@kairu-ms kairu-ms commented Jun 24, 2021

closed #863
closed #861

The custom function for update is invalid in latest released autorest

autorest --version=3.0.6370 --az --use=https://github.com/Azure/autorest.az/releases/download/1.7.3-b.20210610.1/autorest-az-1.7.3.tgz ..\..\azure-rest-api-specs\specification\hybridcompute\resource-manager\readme.md --azure-cli-extension-folder=..\..\azure-cli-extensions

The output has syntax issue.

def connectedmachine_private_link_scope_update(instance,
                                               resource_group_name,
                                               scope_name,
                                               location,
                                               tags=None,
                                               public_network_access=None):
    if public_network_access is None:
        public_network_access = "Disabled"
    if location is not None:
        instance.location = location
    if tags is not None:
        instance.tags = tags
    if "Disabled" is not None:,        instance.properties.public_network_access = "Disabled" if public_network_access is None else public_network_access
    return instance

The fixed output is

def connectedmachine_private_link_scope_update(instance,
                                               resource_group_name,
                                               scope_name,
                                               location,
                                               tags=None,
                                               public_network_access=None):
    if public_network_access is None:
        public_network_access = "Disabled"
    if location is not None:
        instance.location = location
    if tags is not None:
        instance.tags = tags
    if public_network_access is not None:
        instance.properties.public_network_access = "Disabled" if public_network_access is None else public_network_access
    return instance

@kairu-ms kairu-ms requested a review from qiaozha June 24, 2021 08:56
@kairu-ms
Copy link
Contributor Author

@qiaozha, Please review this PR. Thanks.

@qiaozha
Copy link
Member

qiaozha commented Jun 25, 2021

there's dup logic in your expected output

    if public_network_access is None:
        public_network_access = "Disabled"

and

    if public_network_access is not None:
        instance.properties.public_network_access = "Disabled" if public_network_access is None else public_network_access

@qiaozha
Copy link
Member

qiaozha commented Jun 25, 2021

Also, I wonder why there's a ',' in the original wrong code.

@kairu-ms kairu-ms force-pushed the fix-custom-template-issue branch from 391761b to c0bc7f9 Compare July 2, 2021 02:38
@yonzhan yonzhan requested a review from jsntcy July 21, 2021 03:16
@kairu-ms kairu-ms merged commit 2c670a3 into Azure:master Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants