-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
botservice cli extension #155
Conversation
If this PR is for a new extension or change to an existing extension, use the following to try out the changes in this PR:
|
@@ -0,0 +1,478 @@ | |||
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this file need to be checked-in to the repo?
What's it for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it doesn't . i will add my .vscode folder to gitignore so that this doesnt get in by mistake
src/botservice/azext_bot/__init__.py
Outdated
|
||
from azure.cli.core import AzCommandsLoader | ||
from azext_bot._help import helps #pylint: disable=unused-import | ||
import pdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a debug import that should be removed.
src/botservice/azext_bot/_help.py
Outdated
examples: | ||
- name: Update description on a bot | ||
text: |- | ||
az bot update -n botname -g resource_group_name --set properties.description="some description" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer MyResourceGroup
over resource_group_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same elsewhere.
src/botservice/azext_bot/custom.py
Outdated
|
||
if not msa_app_id: | ||
msa_app_id, password = provisionConvergedApp(resource_name) | ||
print('obtained msa app id and password. Provisioning bot now.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use logger.warning instead of print.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
src/botservice/azext_bot/custom.py
Outdated
from azext_bot.botservice import AzureBotService | ||
from azext_bot.botservice.models import Bot, BotProperties,sku, BotChannel | ||
from azure.cli.command_modules.appservice.custom import enable_zip_deploy, config_source_control, get_app_settings, _get_site_credential, _get_scm_url | ||
from azure.cli.command_modules.resource.custom import deploy_arm_template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on other command modules like this is potentially brittle.
The command modules you import have no idea you're using them in this way so this could break the extension in the future.
It's okay to leave it as is since you mentioned you plan to move in to the CLI so it will be less of an issue then but still not recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is true. longterm, should i talk to the other cli module teams to make sure that they continue to support these functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, your extension/module should not rely on other modules so you shouldn't have these imports at all. You can either copy the functionality into your module or we could move them into the core so that a common implementation is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either of the 2 funcitonalities are acceptable to me. i am thinking of making the changes in another PR though since i dont want to break anything this close to build conference. Is it ok to get this checked in and onto the index.json and then taking the dependency off (by copying the code over)?
src/botservice/azext_bot/custom.py
Outdated
deploy_result = deploy_arm_template( | ||
cmd = cmd, | ||
resource_group_name = resource_group_name, | ||
template_file = '{0}\\{1}'.format(dir_path, template_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work on Linux/macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to use os.path.join instead of string concatenation. That will make it os independent.
src/botservice/azext_bot/custom.py
Outdated
|
||
#since there is no git url it's definitely publish from local | ||
if not code_dir: | ||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can really just import os at the very top of the file instead of importing it so many times.
Same with other standard python imports such as shutil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! thanks. .updated the code to move os, shutil and json imports to the top of the file
src/botservice/setup.py
Outdated
HISTORY = f.read() | ||
|
||
setup( | ||
name='azurebotextension', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change name of extension.
e.g. to just botservice
since that's the name of the directory in this PR.
Then user would install with az extension add -n botservice
@swagatmishra2007 Thanks for the changes. Please take a look at the CI failure for style. |
@tjprescott Does it look good to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Migrating containerapp-compose into containerapp
this changelist contains the following changes -