Skip to content

Add profile switching params and profile listing command#2398

Merged
derekbekoe merged 6 commits intoAzure:api-profile-supportfrom
derekbekoe:cloud-profile-switching
Mar 7, 2017
Merged

Add profile switching params and profile listing command#2398
derekbekoe merged 6 commits intoAzure:api-profile-supportfrom
derekbekoe:cloud-profile-switching

Conversation

@derekbekoe
Copy link
Copy Markdown
Member

@derekbekoe derekbekoe commented Mar 7, 2017

  • Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
  • Add ability to view all supported API versions without querying a cloud
  • Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

note: With this change, switching profile will not change anything as they are just example profiles.

FYI @lmazuel For the _shared.py file change. This would contain the resource type to api version map.

Closes #2280
Closes #2279
Closes #2265

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.
@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 7, 2017

Codecov Report

Merging #2398 into api-profile-support will increase coverage by 0.01%.
The diff coverage is 83.33%.

@@                   Coverage Diff                   @@
##           api-profile-support    #2398      +/-   ##
=======================================================
+ Coverage                72.33%   72.34%   +0.01%     
=======================================================
  Files                      323      325       +2     
  Lines                    18273    18311      +38     
  Branches                  2701     2707       +6     
=======================================================
+ Hits                     13217    13248      +31     
- Misses                    4223     4230       +7     
  Partials                   833      833
Impacted Files Coverage Δ
...azure-cli-core/azure/cli/core/profiles/init.py 100% <100%> (ø)
src/azure-cli-core/azure/cli/core/cloud.py 70.23% <100%> (+3.74%)
...cli-cloud/azure/cli/command_modules/cloud/_help.py 100% <100%> (ø)
...-cloud/azure/cli/command_modules/cloud/commands.py 100% <100%> (ø)
.../azure-cli-core/azure/cli/core/profiles/_shared.py 100% <100%> (ø)
src/azure-cli-core/azure/cli/core/_profile.py 83.78% <100%> (-0.15%)
...i-cloud/azure/cli/command_modules/cloud/_params.py 93.33% <100%> (+1.02%)
...li-cloud/azure/cli/command_modules/cloud/custom.py 17.54% <12.5%> (-0.83%)

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 4c0fdcf...b275544. Read the comment docs.

Copy link
Copy Markdown
Contributor

@yugangw-msft yugangw-msft left a comment

Choose a reason for hiding this comment

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

Left 2 questions for clarifications. The rest LGTM

c = Cloud(cloud_name)
for arg in cloud_args:
if arg == 'profile' and cloud_args[arg] is not None:
c.profile = cloud_args[arg]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Saw this pattern been used a few times. Can this if branch be moved out of the loop and become

   c.profile = cloud_args.get('profile', None)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah that works. Will change.

except configparser.DuplicateSectionError:
if not overwrite:
raise CloudAlreadyRegisteredException(cloud.name)
if cloud.profile is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to differentiate between None and empty string? If yes, what does empty string imply?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is no longer needed. if cloud.profile is sufficient.

@derekbekoe derekbekoe merged commit bf7c56f into Azure:api-profile-support Mar 7, 2017
@derekbekoe derekbekoe deleted the cloud-profile-switching branch March 7, 2017 23:41
derekbekoe added a commit that referenced this pull request Mar 16, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Mar 17, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Mar 21, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit to derekbekoe/azure-cli that referenced this pull request Mar 27, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Apr 4, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Apr 7, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Apr 7, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Apr 10, 2017
* Add profile switching and profile listing

- Modify ‘az cloud register’ and ‘az cloud update’ to include the ‘—profile’ parameter
- Add ability to view all supported API versions without querying a cloud

note: With this change, switching profile will not change anything as they are just example profiles.

* Fix pylint!!

* Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Fix pep8

* Fix hasattr() behaving differently in Python 3

* Code review changes
derekbekoe added a commit that referenced this pull request Apr 11, 2017
- Use published SDKs available on PyPI now
- Loading versioned models for network and resources, object model initialization changes for 2015-* profile (#2812)
- Custom ca certs - Setting Requests_ca_bundle environment variable (#2813)
- changes for 2015-* profile to work against azure stack  (#2794)
- Loading versioned Resources client and versioned models in VM
- Updating the supported api-versions for the 2015-example profile
- Fixing network, compute sdk load errors for 2015-* profiles (+5 squashed commit)
- Support multi-API versioned Storage dataplane SDK (#2796)
- Support multi-versioned mgmt SDK (#2526)
- Fix token "management" endpoint is being used in the place of "activeDirectoryResourceId" (#2410)
- Add profile switching params and profile listing command (#2398)
- Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set
@derekbekoe derekbekoe mentioned this pull request Apr 11, 2017
3 tasks
derekbekoe added a commit that referenced this pull request Apr 13, 2017
- Use published SDKs available on PyPI now
- Loading versioned models for network and resources, object model initialization changes for 2015-* profile (#2812)
- Custom ca certs - Setting Requests_ca_bundle environment variable (#2813)
- changes for 2015-* profile to work against azure stack  (#2794)
- Loading versioned Resources client and versioned models in VM
- Updating the supported api-versions for the 2015-example profile
- Fixing network, compute sdk load errors for 2015-* profiles (+5 squashed commit)
- Support multi-API versioned Storage dataplane SDK (#2796)
- Support multi-versioned mgmt SDK (#2526)
- Fix token "management" endpoint is being used in the place of "activeDirectoryResourceId" (#2410)
- Add profile switching params and profile listing command (#2398)
- Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set
derekbekoe added a commit that referenced this pull request Apr 14, 2017
* API Profile Support

- Use published SDKs available on PyPI now
- Loading versioned models for network and resources, object model initialization changes for 2015-* profile (#2812)
- Custom ca certs - Setting Requests_ca_bundle environment variable (#2813)
- changes for 2015-* profile to work against azure stack  (#2794)
- Loading versioned Resources client and versioned models in VM
- Updating the supported api-versions for the 2015-example profile
- Fixing network, compute sdk load errors for 2015-* profiles (+5 squashed commit)
- Support multi-API versioned Storage dataplane SDK (#2796)
- Support multi-versioned mgmt SDK (#2526)
- Fix token "management" endpoint is being used in the place of "activeDirectoryResourceId" (#2410)
- Add profile switching params and profile listing command (#2398)
- Use ARM 'resource manager' endpoint if ASM 'management' endpoint not set

* Address code review feedback

Fix pylint and pep8 (+7 squashed commits)
Squashed commits:
[f1d4d52] Refactor to use joint method
[f43785a] Use generic method to get versioned SDK attributes
[2100dd2] Add log debug if enum default not found
[5767f41] Add single_placement_group back in for vmss
[05ca8bc] Revert a test change. It has been fixed in master.
[cdf4211] Simplify str override method
[281c755] Clarify use of getattr

* Fix patching the operation versions

* Fix wrong import

* Rename shared to _shared

* Add message to cloud debug message

* Remove public method ‘get_versioned_sdk_path’ from azure.cli.core.profiles

* Remove unused import

* Use setattr

* Add API version comparisons

* Add method docs

* Fix failing test
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.

5 participants