Skip to content
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

Add auto-registration for resource providers. #1330

Merged
merged 2 commits into from
Nov 23, 2016

Conversation

brendandburns
Copy link
Member

Fixes #1309

state = providers.get(resource_provider_namespace=namespace)
if state.registration_state != 'Registered':
logger.info('registering {}', namespace)
providers.register(resource_provider_namespace=namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note, this will only flag the state to 'registering', but it is unknown when it will become "registered". So what is being done here is not reliable, though it is useful

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue mentioned at #1309 might not be addressed by this change, because that issue surfaced during deployment, when arm did try to register the provider for you, but failed after 1 minute wait.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, in this case the user mentioned that it repeatedly occurred. I figure this can't hurt, might help?

Copy link
Contributor

@yugangw-msft yugangw-msft Nov 16, 2016

Choose a reason for hiding this comment

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

let us do this, since you will need to re-record http traffic for the acs end to end tests.

  1. Manually un-register the compute, network, storage
  2. Delete the .yaml of the test
  3. Run the test
    If the test passes, I will merge once the CI is green

Copy link
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.

Let 2 comments for clarification
/cc: @ravbhatnagar

@brendandburns brendandburns force-pushed the register branch 2 times, most recently from 255dd14 to 3f1cb27 Compare November 22, 2016 06:51
@brendandburns
Copy link
Member Author

@yugangw-msft I think this is ready to go. After consulting w/ ARM folks, I think that this is a good solution to help resolve this issue.

Thanks!
--brendan

Copy link
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.

Please back out an unrelated file change. And I will then merge

@@ -56,8 +56,7 @@
_COMMON_TENANT = 'common'

_AUTH_CTX_FACTORY = lambda authority, cache: adal.AuthenticationContext(authority,
cache=cache,
api_version=None)
cache=cache)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please back out this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Without this change, re-generating the unit test recording fails.

I'm happy to split it out as a separate fix, but I think it should be fixed...

Copy link
Contributor

Choose a reason for hiding this comment

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

What error did you see? Regenerating recording should not use anything related with this class, or it is a bug i can take a look.
FYI, we do need to set api-version to none, so adal will switch to newer api-version at 1.1+; otherwise tokens issued for webapi associated resource might be invalid. please refer to the issue AzureAD/azure-activedirectory-library-for-python#54

Copy link
Member

Choose a reason for hiding this comment

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

@brendandburns Run python scripts/dev_setup.py in your environment so that you have the latest dependencies as our adal version was recently updated and that's why you see an error.

Copy link
Member

Choose a reason for hiding this comment

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

It's likely you have the older version of adal in your environment which directly affected this.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@brendandburns
Copy link
Member Author

Ok, removed the extraneous change. This is ready to go.

Thanks!

@yugangw-msft yugangw-msft merged commit e260cf7 into Azure:master Nov 23, 2016
thegalah pushed a commit to thegalah/azure-cli that referenced this pull request Nov 28, 2016
* Azure/master: (39 commits)
  User should use no-cache so we build a fresh image (Azure#1455)
  Bump all modules to version 0.1.0b10 (Azure#1454)
  [Docs] Move around the order of install instructions. (Azure#1439)
  acs: *_install_cli mark cli as executable (Azure#1449)
  Fix resource list table. (Azure#1452)
  [Compute] VM NIC updates (Azure#1421)
  Introduce batch upload and download for blob (Azure#1428)
  Add auto-registration for resource providers. (Azure#1330)
  interpret the '@' syntax if something higher hasn't already done that. (Azure#1423)
  Aliasing plan argument with shorthand (Azure#1433)
  ad:fix one more place which still uses localtime for secret starttime (Azure#1429)
  Add table formatting for deployments and sort by timestmap. (Azure#1427)
  Add table formatting for resource group list (and add 'status') (Azure#1425)
  [Docs] Add shields specifying latest version and supported python versions (Azure#1420)
  Add new az storage blob copy start-batch command (Azure#1250)
  Component Discovery (Azure#1409)
  Add poison logic to prevent re-recording tests that need updating. (Azure#1412)
  [Storage] Fix storage table outputs and help text. (Azure#1402)
  [mention-bot] Attempt to fix config (Azure#1410)
  ad:use utc time on setting app's creds (Azure#1408)
  ...
xscript pushed a commit to xscript/azure-cli that referenced this pull request Nov 30, 2016
* Add auto-registration for resource providers.

* update unit test recording.
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