Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1644)

Issue 12270043: Query Azure storage account key from Azure. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by jtv.canonical
Modified:
10 years, 9 months ago
Reviewers:
mue, rvb, mp+178131
Visibility:
Public.

Description

Query Azure storage account key from Azure. As per the planned phasing of the Azure provider, the environment's config must currently still specify a key for the environment's Azure storage account. The key is available from Azure itself, and here we replace the configuration item with an automated query. The query is performed on demand, and the result cached in a new field on azureEnviron called storageAccountKey. I had wanted to query it immediately when an azureEnviron is created, but that introduced an unexpected Azure request in dozens of tests — some of which already routed such requests to a fake http service but now needed an exta canned response inserted in the right place (not always easy), and others needed extra code to create such a fake in the first place. Not pleasant, so instead I went with on-demand querying, and an update to makeEnviron() which ensures that this query is not needed by default. There were some complications with locking. Go's execution model does not enable the conventional rule where a lock's current owner can grab the lock again without deadlocking. This made it hard to get a handle on the Azure management API from within a critical section, because locking is involved on the lowest level. I used a well-known optimistic technique to get around that, and it also lets us avoid a long-held lock while the Azure query is underway. https://code.launchpad.net/~jtv/juju-core/az-get-storage-key/+merge/178131 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 3

Patch Set 2 : Query Azure storage account key from Azure. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+247 lines, -21 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M environs/azure/config.go View 1 4 chunks +0 lines, -7 lines 0 comments Download
M environs/azure/config_test.go View 1 6 chunks +0 lines, -7 lines 0 comments Download
M environs/azure/environ.go View 1 5 chunks +98 lines, -4 lines 0 comments Download
M environs/azure/environ_test.go View 1 5 chunks +147 lines, -3 lines 0 comments Download

Messages

Total messages: 6
jtv.canonical
Please take a look.
10 years, 9 months ago (2013-08-01 17:17:37 UTC) #1
mue
LGTM, only some minor comments. https://codereview.appspot.com/12270043/diff/1/environs/azure/environ.go File environs/azure/environ.go (right): https://codereview.appspot.com/12270043/diff/1/environs/azure/environ.go#newcode117 environs/azure/environ.go:117: return "", fmt.Errorf("could not ...
10 years, 9 months ago (2013-08-02 08:54:07 UTC) #2
jtv.canonical
Thanks for the review! Sorry I couldn't follow up right away. > https://codereview.appspot.com/12270043/diff/1/environs/azure/environ.go#newcode117 > environs/azure/environ.go:117: ...
10 years, 9 months ago (2013-08-05 11:36:38 UTC) #3
jtv.canonical
Please take a look.
10 years, 9 months ago (2013-08-05 11:47:03 UTC) #4
rvb
On 2013/08/05 11:47:03, jtv.canonical wrote: > Please take a look. LGTM. [0] 121 +func extractStorageKey(keys ...
10 years, 9 months ago (2013-08-05 12:02:12 UTC) #5
jtv.canonical
10 years, 9 months ago (2013-08-05 12:32:41 UTC) #6
On 2013/08/05 12:02:12, rvb wrote:

> Maybe I'm wrong but I don't see that any of the auto-generated keys can be the
> empty string.  Couldn't we just use the primary key and simplify the code a
bit?

Thanks.  From just trying it I would say yes.  This is input from Azure,
however, so I'm being a little bit paranoid about it.  Very little is actually
documented about what's in that struct.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b