Skip to content

Conversation

@jp94
Copy link
Contributor

@jp94 jp94 commented May 7, 2018


This checklist is used to make sure that common guidelines for a pull request are followed.

  • The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).

  • I adhere to the Command Guidelines.


Refer to #5716
We were having a service rename from Location Based Services to Maps.
Since the timeline was short and that there was an embargo on "Azure Maps" name, the PR was canceled.
We are ready to on-board Azure Maps command module now.

@lmazuel @tjprescott

jp94 and others added 25 commits February 23, 2018 15:12
- Add the Preview Terms agreement requirement
- Remove location, custom_header, and raw parameters for account operations.
[Fix] --key-type, -t are now --key
[Refactor] get_account command now specifically throws error only if it's a 404 response.
@promptws
Copy link

promptws commented May 7, 2018

View a preview at https://prompt.ws/r/Azure/azure-cli/6303
This is an experimental preview for @microsoft users.

@tjprescott
Copy link
Member

@jp94 which dev are you working with on the CLI side?

@lmazuel
Copy link
Member

lmazuel commented May 7, 2018

@tjprescott package is released:
https://pypi.org/project/azure-mgmt-maps/

@jp94
Copy link
Contributor Author

jp94 commented May 8, 2018

The build error states,

AssertionError: Make sure /home/travis/build/Azure/azure-cli/src/command_modules/azure-cli-maps/azure_bdist_wheel.py is correct. It should look like /home/travis/build/Azure/azure-cli/src/azure-cli-core/azure_bdist_wheel.py

I diff checked, but it says they are identical.

logger = get_logger(__name__)


# pylint: disable=line-too-long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break line instead of disabling pylint.

@tjprescott
Copy link
Member

See #5716 for intial review.

@tjprescott tjprescott self-requested a review May 8, 2018 16:58
@tjprescott tjprescott added this to the Sprint 37 milestone May 8, 2018
@tjprescott
Copy link
Member

@derekbekoe what is the fix for the bdist wheel issue?

Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. A couple feedback points for your consideration. Would like @sptramer to review the help entries and then I'll sign-off.

completer=get_resource_name_completion_list(
'Microsoft.Maps/accounts'),
help='The name of the Maps Account',
validator=validate_account_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As your module grows, this will get very cumbersome. Most modules simply put one entry on one line and disable pylint's "line-too-long" warning. Up to you. Opinions vary (mine is pretty clearly in favor of long lines)

options_list=['--sku', '-s'],
help='The name of the SKU, in standard format (such as S0).',
arg_type=get_enum_type(['S0']),
required=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need required=False. If your method signature has sku_name=None the CLI will already deduce this.

if not ACCOUNT_NAME_MIN_LENGTH <= char_len <= ACCOUNT_NAME_MAX_LENGTH:
raise CLIError("Input account-name is invalid. Account name character length must be between 2 and 64.")
if not re.match(ACCOUNT_NAME_REGEX, account_name):
raise CLIError("Input account-name is invalid. Allowed regex: " + ACCOUNT_NAME_REGEX.pattern +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your service error is clear enough, I'd recommend you avoid putting this client-side validation in. Otherwise, if the service later becomes more forgiving, the CLI will artificially restrict valid names. If the service error is not good enough, then this is an okay workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You make a good point here.

@tjprescott tjprescott requested a review from sptramer May 8, 2018 17:05
@derekbekoe
Copy link
Member

@jp94 This is the azure_bdist_wheel.py file in your PR - https://github.com/Azure/azure-cli/pull/6303/files#diff-3423f41d513e4e7b0cb1d04b1d23b5c7.

This is the one that it compares against - https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure_bdist_wheel.py.

They are not the same.

@codecov-io
Copy link

codecov-io commented May 8, 2018

Codecov Report

❗ No coverage uploaded for pull request base (dev@8b1c318). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff          @@
##             dev   #6303   +/-   ##
=====================================
  Coverage       ?      0%           
=====================================
  Files          ?      11           
  Lines          ?     133           
  Branches       ?       9           
=====================================
  Hits           ?       0           
  Misses         ?     133           
  Partials       ?       0
Impacted Files Coverage Δ
...ure-cli-maps/azure/cli/command_modules/__init__.py 0% <0%> (ø)
...e-cli-maps/azure/cli/command_modules/maps/_help.py 0% <0%> (ø)
.../azure/cli/command_modules/maps/_client_factory.py 0% <0%> (ø)
...ommand_modules/azure-cli-maps/azure_bdist_wheel.py 0% <0%> (ø)
...mmand_modules/azure-cli-maps/azure/cli/__init__.py 0% <0%> (ø)
src/command_modules/azure-cli-maps/setup.py 0% <0%> (ø)
...-cli-maps/azure/cli/command_modules/maps/custom.py 0% <0%> (ø)
...c/command_modules/azure-cli-maps/azure/__init__.py 0% <0%> (ø)
...li-maps/azure/cli/command_modules/maps/__init__.py 0% <0%> (ø)
...li-maps/azure/cli/command_modules/maps/commands.py 0% <0%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b1c318...19b2fe9. Read the comment docs.

jp94 added 2 commits May 8, 2018 23:53
Removed validators.py. Will be adding checks in REST API specs and our backend routes to avoid redundancy.

Updated azure_bdist_wheel.py
Introduced minor fixes.
@jp94
Copy link
Contributor Author

jp94 commented May 9, 2018

Looks like I didn't pull the latest code from the dev branch, and I was still seeing the old azure_bdist_wheel.py

Removed validators.py. This results in error stacktrace with a generic response "Operation returned an invalid status code 'Bad Request'". We will be adding checks in REST API specs and our backend routes to avoid redundancy. I'll talk to my manager about getting this in. Let me know if this change should be reverted for the duration, or if this is okay.

Copy link
Contributor

@sptramer sptramer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some help copyedit changes.


helps['maps'] = """
type: group
short-summary: Manage Azure Maps accounts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical to the maps account description, which indicates the subgroup is unnecessary. If the toplevel namespace is used for future expansion, change this description.

Copy link
Contributor Author

@jp94 jp94 May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I remove the helps['maps'] or helps['maps account']?
I removed helps['maps'], because removing helps['maps account'] makes "az maps account -h" to not give a short summary.


helps['maps account list'] = """
type: command
short-summary: Show all Maps accounts in a Subscription or in a Resource Group.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase subscription and resource group. Only capitalize Maps if used as Azure Maps.

Copy link
Contributor Author

@jp94 jp94 May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've lowercase'd all "Maps" to "maps", except for "Azure Maps".
This includes "the Maps APIs" to "the maps APIs" as well correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maps APIs refers directly to a product name, so Maps should be capitalized there.

helps['maps account create'] = """
type: command
short-summary: Create a Maps account.
long-summary: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this long summary is needed; does not add information.

helps['maps account keys list'] = """
type: command
short-summary: List the keys to use with the Maps APIs.
long-summary: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the first sentence. long-description is always a supplement to short-description.

helps['maps account keys renew'] = """
type: command
short-summary: Renew either the primary or secondary key for use with the Maps APIs.
long-summary: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite as This command immediately invalidates old API keys. Only the renewed keys can be used to connect to maps.

# Argument Definition
maps_name_type = CLIArgumentType(options_list=['--name', '-n'],
completer=get_resource_name_completion_list('Microsoft.Maps/accounts'),
help='The name of the Maps Account')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase maps and account

with self.argument_context('maps account') as c:
c.argument('sku_name',
options_list=['--sku', '-s'],
help='The name of the SKU, in standard format (such as S0).',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything after the , - the valid values are enumerated in help.


with self.argument_context('maps account keys renew') as c:
c.argument('key_type',
options_list=['--key'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the help for this argument pulled from elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This help is being pulled from the Azure Python SDK (Maps).

Command
    az maps account keys renew: Renew either the primary or secondary key for use with the maps
    APIs.
        This command immediately invalidates old API keys. Only the renewed keys can be used to
        connect to maps.

Arguments
    --key     [Required]: Whether the operation refers to the primary or secondary key.  Allowed
                          values: primary, secondary.
    --name -n [Required]: The name of the maps account.
    --resource-group -g : Resource group name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jp94
Copy link
Contributor Author

jp94 commented May 12, 2018

I've been trying to resolve azdev verify module-load-perf (PURPOSE='Module Load Performance').
I was able to fix the servicefabric module failing by reverting merge remote-tracking branch 'upstream/dev' into rename. Do you know what may have caused it to fail?
Obviously, I don't want to push the merge reverts.

For example, my previous commit passed for module-load-perf: https://travis-ci.org/Azure/azure-cli/jobs/376134725 But after merging with dev branch, it failed: https://travis-ci.org/Azure/azure-cli/jobs/376565890

@troydai
Copy link
Contributor

troydai commented May 14, 2018

@tjprescott the module local perf test keep failing in service fabric. Any idea?

@tjprescott
Copy link
Member

@troydai I sent an email about it. It is essentially the same problem, yet identified, that caused us to raise the SQL threshold. Now you'll note SQL is at 3 ms and the problem manifests in servicefabric. I sent @jp94 the workaround.

@tjprescott tjprescott merged commit 36b4b3d into Azure:dev May 14, 2018
@troydai
Copy link
Contributor

troydai commented May 15, 2018

thanks, guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants