Skip to content

ServiceBus CLI Extension#31

Merged
derekbekoe merged 16 commits into
Azure:masterfrom
v-Ajnava:SBmasterExt
Jan 18, 2018
Merged

ServiceBus CLI Extension#31
derekbekoe merged 16 commits into
Azure:masterfrom
v-Ajnava:SBmasterExt

Conversation

@v-Ajnava

@v-Ajnava v-Ajnava commented Jan 9, 2018

Copy link
Copy Markdown

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

General Guidelines

  • Have you run ./scripts/ci/test_static.sh locally? (pip install pylint flake8 required)
  • Have you run python scripts/ci/test_integration.py -q locally?

@derekbekoe

Copy link
Copy Markdown
Member

@v-Ajnava Is this ready for review?

@v-Ajnava

Copy link
Copy Markdown
Author

@derekbekoe yes, you can review it.


helps['servicebus'] = """
type: group
short-summary: Manage Azure ServiceBus namespace, queue, topic, subscription, rule and geo disaster recovery configuration - alias

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe the proper service name is 'Service Bus' not 'ServiceBus'.
Can you change this in the help file?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved


# pylint: disable=unused-import


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Load the _helps file here otherwise it won't be loaded and so no help is shown.

e.g. https://github.com/Azure/azure-cli/blob/dev/src/command_modules/azure-cli-batchai/azure/cli/command_modules/batchai/__init__.py#L8

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

type: command
short-summary: check for the availability of the given name for the Namespace
examples:
- name: Create a new topic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The description title is wrong?
How does servicebus namespace check-name-availability create a new topic?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

short-summary: check for the availability of the given name for the Namespace
examples:
- name: Create a new topic.
text: az servicebus namespace check_name_availability --name mynamespace

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

check_name_availability -> check-name-availability

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

examples:
- name: Create a new namespace.
text: helps['az servicebus namespace create --resource-group myresourcegroup --name mynamespace --location westus
--tags ['tag1: value1', 'tag2: value2'] --sku-name Standard --sku-tier Standard']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bad help text.
Remove the 'helps' and make sure it's a command that can actually be executed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same below...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My Bad, i had observed it but missed to change it. its now resolved


helps['servicebus namespace authorizationrule list-keys'] = """
type: command
short-summary: Shows the connectionstrings of AuthorizatioRule for the namespace

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

connectionstrings should be two words not one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

c.argument('correlation_id', options_list=['--correlation-id'], help='Identifier of the correlation.')
c.argument('message_id', options_list=['--message-id'], help='Identifier of the message.')
c.argument('to', options_list=['--to'], help='Address to send to.')
c.argument('reply_to', options_list=['--reply_to'], help='Address of the queue to reply to.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--reply_to -> --reply-to

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

Comment thread src/servicebus/setup.py Outdated
author_email='v-ajnava@microsoft.com',
url='https://github.com/Azure/azure-cli-extensions',
classifiers=CLASSIFIERS,
packages=find_packages(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change to find_packages(exclude=["tests"])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me know if the CI tests check fails because of this.
Ideally we don't want tests in the built package.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

Comment thread src/servicebus/setup.py Outdated
name='servicebus',
version=VERSION,
description='An Azure CLI Extension to manage servicebus resources',
long_description='An Azure CLI Extension to manage servicebus resources',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'Service Bus'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

' --alias {aliasname}')

getaliasafterbreak = self.cmd(
'servicebus georecovery-alias show --resource-group {rg} --namespace-name {namespacenameprimary} --alias {aliasname}').output

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can use get_output_in_json() so no need to do the json.loads.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

@v-Ajnava

Copy link
Copy Markdown
Author

@derekbekoe , we have below cmdlet name changes

regenerate-keys to keys renew
check-name-availability to exists
servicebus georecovery-alias break-pairing to servicebus georecovery-alias break-pair

@derekbekoe derekbekoe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@v-Ajnava I started reviewing but there are still multiple things wrong with this PR. This is what I have noted down so far.
Also, there are still some typos such as with --name in az servicebus namespace exists

examples:
- name: Create a Service Bus Namespace.
text: az servicebus namespace create --resource-group myresourcegroup --name mynamespace --location westus
--tags ['tag1' 'value1', 'tag2' 'value2'] --sku-name Standard --sku-tier Standard

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--tags tag1=value1 tag2=value2
What you currently have doesn't work.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

short-summary: Shows the Service Bus Namespace details
examples:
- name: shows the Namespace details.
text: helps['az servicebus namespace show --resource-group myresourcegroup --name mynamespace']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

az servicebus namespace show --resource-group myresourcegroup --name mynamespace
What you currently have doesn't work.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription
examples:
- name: Get the Service Bus Namespaces by resource Group.
text: helps['az servicebus namespace list --resource-group myresourcegroup']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved


helps['servicebus namespace list'] = """
type: command
short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove ' by ResourceGroup or by subscription'.
This follows the convention of other list commands.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

type: command
short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription
examples:
- name: Get the Service Bus Namespaces by resource Group.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: lower case G for Group

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

examples:
- name: Creates Authorizationrule 'myauthorule' for the given Service Bus Namespace 'mynamepsace' in resourcegroup
text: az servicebus namespace authorizationrule create --resource-group myresourcegroup --namespace-name mynamespace
--name myauthorule --access-rights [Send, Listen]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This won't work. If you want both Send and Listen it should be --access-rights Send Listen I guess...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

examples:
- name: Creates Service Bus Queue.
text: az sb queue create --resource-group myresourcegroup --namespace-name mynamespace --name myqueue
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's no command az sb queue create.
Should this be az servicebus queue create?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

examples:
- name: Creates Authorization rules for Queue
text: az servicebus queue authorizationrule create --resource-group myresourcegroup --namespace-name mynamespace
--queue-name myqueue --name myauthorule --access-rights [Listen]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Listen not [Listen]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

short-summary: Creates the Service Bus Topic
examples:
- name: Create a new queue.
text: az servicebus topic create --resource-group myresourcegroup --namespace-name mynamespace --name {topicname}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove {} around {topicname}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

short-summary: Shows the Service Bus Topic Details
examples:
- name: Shows the Topic details.
text: az sb topic get --resource-group myresourcegroup --namespace-name mynamespace --name {topicname}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here.
And there is no az sb topic show command.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

@v-Ajnava

Copy link
Copy Markdown
Author

@derekbekoe, have fixed the help issues.

@derekbekoe derekbekoe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the change to _params.py is too much for you to change, you can leave as is. Just note that arguments_context doesn't have to apply to a specific command. It can apply to a whole group such as all commands under servicebus. This would have made the params.py a lot smaller as a lot of the params are just duplicated.


helps['servicebus queue authorizationrule keys list'] = """
type: command
short-summary: Shows the connectionstrings of AuthorizationRule for the Queue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't 'connectionstrings' be two words?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

# pylint: disable=line-too-long
def load_arguments_namespace(self, _):
with self.argument_context('servicebus namespace exists') as c:
c.argument('namespace_name', options_list=['--name'], help='name of the Namespace')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For all --name options, also add -n to the list so short options work. They are very common in the CLI.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

c.argument('namespace_name', options_list=['--name', '-n'], help='name of the Namespace')

with self.argument_context('servicebus namespace list') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do this at the start of _params.py.

Then you don't have to keep on doing it for each command as it will apply for all.
Then you can remove all the c.argument('resource_group_name', arg_type=resource_group_name_type,) everywhere.

with self.argument_context('servicebus') as c:
    c.argument('resource_group_name', arg_type=resource_group_name_type)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved, please verify .

--name myauthorule
"""

helps['sb queue create'] = """

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is still wrong here...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

text: az servicebus topic create --resource-group myresourcegroup --namespace-name mynamespace --name mytopic
"""

helps['sb topic show'] = """

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here..

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

--subscription-name mysubscription --name myrule
"""

helps['sb rule list'] = """

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved

@derekbekoe

derekbekoe commented Jan 18, 2018

Copy link
Copy Markdown
Member

Looks good.
Please add the metadata file.
Like this:
https://github.com/Azure/azure-cli-extensions/blob/master/src/image-copy/azext_imagecopy/azext_metadata.json

You can set the min version to 2.0.25.

@v-Ajnava

Copy link
Copy Markdown
Author

@derekbekoe I added the metadata file.

@derekbekoe derekbekoe merged commit 5e43e0e into Azure:master Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants