DescriptionQuery 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. #
MessagesTotal messages: 6
|