-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Service Fabric] Add Service Fabric Application commands #10666
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
caec0f1
adding application commands and tests
4f79875
adding changes to history.rst
ddec557
fix style and add files to azure-cli.pyproj
3312b91
adding help messages and application_type_version param name
fd10428
add commands description to history.rst
d47cd38
add help for application commands
4d69536
add init to operations folder
2f0459f
remove unused parameters and fix python2 syntax error
efb7b01
fix more python2 syntax errors
ed18afe
remove unused import
4f2282d
address ARM review: fix params, add shorter alias and add help for sh…
3cd88d7
separate cluster and application tests
4df9be8
fix history.rst after rebase
8579a5f
address pr comments
d7b7af2
re-record test
a43605e
move release history to the top
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/azure-cli/azure/cli/command_modules/servicefabric/_arm_deployment_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
import datetime | ||
|
||
from azure.cli.core.util import CLIError, sdk_no_wait | ||
from azure.cli.core.commands import LongRunningOperation | ||
from azure.cli.core.profiles import ResourceType | ||
from knack.log import get_logger | ||
from ._client_factory import (resource_client_factory) | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
def validate_and_deploy_arm_template(cmd, resource_group_name, template, parameters): | ||
suffix = datetime.datetime.now().strftime("%Y%m%d%H%M") | ||
deployment_name = 'AzurePSDeployment-' + suffix | ||
|
||
logger.info("Validating the deployment") | ||
validate_result = _deploy_arm_template_core( | ||
cmd, resource_group_name, template, parameters, deployment_name, 'incremental', True) | ||
if validate_result.error is not None: | ||
errors_detailed = _build_detailed_error(validate_result.error, []) | ||
errors_detailed.insert(0, "Error validating template. See below for more information.") | ||
raise CLIError('\n'.join(errors_detailed)) | ||
logger.info("Deployment is valid, and begin to deploy") | ||
_deploy_arm_template_core(cmd, resource_group_name, template, | ||
parameters, deployment_name, 'incremental', False) | ||
|
||
|
||
def _deploy_arm_template_core(cmd, | ||
resource_group_name, | ||
template, | ||
parameters, | ||
deployment_name=None, | ||
mode='incremental', | ||
validate_only=False, | ||
no_wait=False): | ||
DeploymentProperties = cmd.get_models('DeploymentProperties', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) | ||
properties = DeploymentProperties( | ||
template=template, template_link=None, parameters=parameters, mode=mode) | ||
client = resource_client_factory(cmd.cli_ctx) | ||
if validate_only: | ||
return sdk_no_wait(no_wait, client.deployments.validate, resource_group_name, deployment_name, properties) | ||
|
||
deploy_poll = sdk_no_wait(no_wait, client.deployments.create_or_update, resource_group_name, | ||
deployment_name, properties) | ||
result = LongRunningOperation(cmd.cli_ctx)(deploy_poll) | ||
return result | ||
|
||
|
||
def _build_detailed_error(top_error, output_list): | ||
if output_list: | ||
output_list.append(' Inner Error - Code: "{}" Message: "{}"'.format(top_error.code, top_error.message)) | ||
else: | ||
output_list.append('Error - Code: "{}" Message: "{}"'.format(top_error.code, top_error.message)) | ||
|
||
if top_error.details: | ||
for error in top_error.details: | ||
_build_detailed_error(error, output_list) | ||
|
||
return output_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have to update release note in history.rst at right position.
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.
fixed