You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2017/09/19 21:00:59 UTC
[01/11] libcloud git commit: Use TagSpecification parameter on EC2
create_node
Repository: libcloud
Updated Branches:
refs/heads/trunk cbae34ad0 -> 91ea09116
Use TagSpecification parameter on EC2 create_node
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/379cfe7e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/379cfe7e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/379cfe7e
Branch: refs/heads/trunk
Commit: 379cfe7e4cce5209b6353e3087bc3131671a9924
Parents: 84735c8
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Tue Aug 29 19:06:18 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Tue Aug 29 19:06:18 2017 -0300
----------------------------------------------------------------------
libcloud/__init__.py | 2 +-
libcloud/compute/drivers/ec2.py | 22 +++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/379cfe7e/libcloud/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/__init__.py b/libcloud/__init__.py
index 24d4a68..773c03f 100644
--- a/libcloud/__init__.py
+++ b/libcloud/__init__.py
@@ -36,7 +36,7 @@ __all__ = [
'__version__',
'enable_debug'
]
-__version__ = '2.2.0'
+__version__ = '2.2.0.dev1'
def enable_debug(fo):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/379cfe7e/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index efb6275..fd807aa 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -3765,19 +3765,23 @@ class BaseEC2NodeDriver(NodeDriver):
if subnet_id:
params['SubnetId'] = subnet_id
+ # Specify tags at instance creation time
+ tags = {'Name': kwargs['name']}
+ if 'ex_metadata' in kwargs:
+ tags.update(kwargs['ex_metadata'])
+ tagspec_root = 'TagSpecification.1.'
+ params[tagspec_root + 'ResourceType'] = 'instance'
+ tag_nr = 1
+ for k, v in tags.iteritems():
+ tag_root = tagspec_root + "Tag.{}.".format(tag_nr)
+ params[tag_root + "Key"] = k
+ params[tag_root + "Value"] = v
+ tag_nr += 1
+
object = self.connection.request(self.path, params=params).object
nodes = self._to_nodes(object, 'instancesSet/item')
for node in nodes:
- tags = {'Name': kwargs['name']}
- if 'ex_metadata' in kwargs:
- tags.update(kwargs['ex_metadata'])
-
- try:
- self.ex_create_tags(resource=node, tags=tags)
- except Exception:
- continue
-
node.name = kwargs['name']
node.extra.update({'tags': tags})
[09/11] libcloud git commit: Refactor get_instance_vhd from a closure
method to instance method so it can be tested more easily.
Posted by to...@apache.org.
Refactor get_instance_vhd from a closure method to instance method so it
can be tested more easily.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2a8764b1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2a8764b1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2a8764b1
Branch: refs/heads/trunk
Commit: 2a8764b1d4dffaf2217a670323b31cef953d1679
Parents: 91d14ea
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:48:52 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 22:48:52 2017 +0200
----------------------------------------------------------------------
libcloud/compute/drivers/azure_arm.py | 47 ++++++++++++++++++------------
1 file changed, 29 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2a8764b1/libcloud/compute/drivers/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index f7e8a1b..8950c2a 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -534,23 +534,12 @@ class AzureNodeDriver(NodeDriver):
"/Microsoft.Compute/virtualMachines/%s" % \
(self.subscription_id, ex_resource_group, name)
- def _get_instance_vhd():
- n = 0
- while True:
- try:
- instance_vhd = "https://%s.blob%s" \
- "/%s/%s-os_%i.vhd" \
- % (ex_storage_account,
- self.connection.storage_suffix,
- ex_blob_container,
- name,
- n)
- self._ex_delete_old_vhd(ex_resource_group, instance_vhd)
- return instance_vhd
- except LibcloudError:
- n += 1
-
if isinstance(image, AzureVhdImage):
+ instance_vhd = self._get_instance_vhd(
+ name=name,
+ ex_resource_group=ex_resource_group,
+ ex_storage_account=ex_storage_account,
+ ex_blob_container=ex_blob_container)
storage_profile = {
"osDisk": {
"name": name,
@@ -561,7 +550,7 @@ class AzureNodeDriver(NodeDriver):
"uri": image.id
},
"vhd": {
- "uri": _get_instance_vhd(),
+ "uri": instance_vhd,
}
}
}
@@ -589,8 +578,13 @@ class AzureNodeDriver(NodeDriver):
"storageAccountType": ex_storage_account_type
}
else:
+ instance_vhd = self._get_instance_vhd(
+ name=name,
+ ex_resource_group=ex_resource_group,
+ ex_storage_account=ex_storage_account,
+ ex_blob_container=ex_blob_container)
storage_profile["osDisk"]["vhd"] = {
- "uri": _get_instance_vhd()
+ "uri": instance_vhd
}
else:
raise LibcloudError(
@@ -2014,6 +2008,23 @@ class AzureNodeDriver(NodeDriver):
return NodeLocation(loc_id, loc, self._location_to_country.get(loc_id),
self.connection.driver)
+ def _get_instance_vhd(self, name, ex_resource_group, ex_storage_account,
+ ex_blob_container="vhds"):
+ n = 0
+ while True:
+ try:
+ instance_vhd = "https://%s.blob%s" \
+ "/%s/%s-os_%i.vhd" \
+ % (ex_storage_account,
+ self.connection.storage_suffix,
+ ex_blob_container,
+ name,
+ n)
+ self._ex_delete_old_vhd(ex_resource_group, instance_vhd)
+ return instance_vhd
+ except LibcloudError:
+ n += 1
+
def _split_blob_uri(uri):
uri = uri.split('/')
[05/11] libcloud git commit: Merge remote-tracking branch
'upstream/trunk' into fix-blob-storage-regression
Posted by to...@apache.org.
Merge remote-tracking branch 'upstream/trunk' into fix-blob-storage-regression
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bbd6d136
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bbd6d136
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bbd6d136
Branch: refs/heads/trunk
Commit: bbd6d1366ff01d88b10f29267667f0f85ed83d90
Parents: 6f0d3aa 59b44a0
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Wed Sep 13 12:28:14 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Wed Sep 13 12:28:14 2017 -0300
----------------------------------------------------------------------
.codecov.yml | 23 ++
.gitignore | 7 +
CHANGES.rst | 21 +
README.rst | 4 +-
.../generate_provider_feature_matrix_table.py | 7 +-
doap_libcloud.rdf | 7 +
.../_supported_methods_block_storage.rst | 2 +-
.../_supported_methods_image_management.rst | 2 +-
docs/compute/_supported_providers.rst | 2 +-
docs/conf.py | 20 +-
docs/copyright.rst | 10 +
docs/dns/_supported_providers.rst | 2 +-
docs/loadbalancer/_supported_providers.rst | 2 +-
docs/storage/_supported_methods_cdn.rst | 2 +
docs/storage/_supported_methods_main.rst | 2 +
docs/storage/_supported_providers.rst | 8 +-
libcloud/compute/drivers/ec2.py | 59 +++
libcloud/compute/drivers/libvirt_driver.py | 2 +-
libcloud/compute/drivers/oneandone.py | 398 ++++++++-----------
libcloud/compute/ssh.py | 5 +-
.../ec2/describe_reserved_instances.xml | 1 +
libcloud/test/compute/test_ec2.py | 9 +-
libcloud/test/conftest.py | 25 ++
requirements-tests.txt | 4 +-
tox.ini | 22 +-
25 files changed, 376 insertions(+), 270 deletions(-)
----------------------------------------------------------------------
[02/11] libcloud git commit: Updated code so it's Python 3 compatible.
Posted by to...@apache.org.
Updated code so it's Python 3 compatible.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/386456c2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/386456c2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/386456c2
Branch: refs/heads/trunk
Commit: 386456c245a3518254f5f6a045832ceb6451e486
Parents: 379cfe7
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Wed Aug 30 18:03:47 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Wed Aug 30 18:03:47 2017 -0300
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/386456c2/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index fd807aa..9737e13 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -3772,7 +3772,7 @@ class BaseEC2NodeDriver(NodeDriver):
tagspec_root = 'TagSpecification.1.'
params[tagspec_root + 'ResourceType'] = 'instance'
tag_nr = 1
- for k, v in tags.iteritems():
+ for k, v in tags.items():
tag_root = tagspec_root + "Tag.{}.".format(tag_nr)
params[tag_root + "Key"] = k
params[tag_root + "Value"] = v
[07/11] libcloud git commit: Merge remote-tracking branch
'curoverse/fix-blob-storage-regression' into trunk
Posted by to...@apache.org.
Merge remote-tracking branch 'curoverse/fix-blob-storage-regression' into trunk
Closes #1110
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ac321e0f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ac321e0f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ac321e0f
Branch: refs/heads/trunk
Commit: ac321e0fde57f287519e47ad141900ed8becb5e4
Parents: cbae34a f33345c
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:34:36 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 22:34:36 2017 +0200
----------------------------------------------------------------------
libcloud/compute/drivers/azure_arm.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[04/11] libcloud git commit: * Reverted version number. * Removed
MockHttp methods as requested on the PR.
Posted by to...@apache.org.
* Reverted version number.
* Removed MockHttp methods as requested on the PR.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6f0d3aa6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6f0d3aa6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6f0d3aa6
Branch: refs/heads/trunk
Commit: 6f0d3aa6d3b5d9db58a998a91ad1088ff3fe6413
Parents: f9118e8
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Thu Aug 31 15:26:03 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Thu Aug 31 15:26:03 2017 -0300
----------------------------------------------------------------------
libcloud/__init__.py | 2 +-
libcloud/test/compute/test_ec2.py | 8 --------
2 files changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f0d3aa6/libcloud/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/__init__.py b/libcloud/__init__.py
index 773c03f..24d4a68 100644
--- a/libcloud/__init__.py
+++ b/libcloud/__init__.py
@@ -36,7 +36,7 @@ __all__ = [
'__version__',
'enable_debug'
]
-__version__ = '2.2.0.dev1'
+__version__ = '2.2.0'
def enable_debug(fo):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f0d3aa6/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 2766fc7..f8a2687 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1526,10 +1526,6 @@ class EC2MockHttp(MockHttp):
body = self.fixtures.load('modify_snapshot_attribute.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
- def _idempotent_CreateTags(self, method, url, body, headers):
- body = self.fixtures.load('create_tags.xml')
- return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
def _CreateVolume(self, method, url, body, headers):
body = self.fixtures.load('create_volume.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
@@ -1741,10 +1737,6 @@ class EucMockHttp(EC2MockHttp):
headers):
return self._RunInstances(method, url, body, headers)
- def _services_Eucalyptus_CreateTags(self, method, url, body,
- headers):
- return self._CreateTags(method, url, body, headers)
-
def _services_Eucalyptus_DescribeInstanceTypes(self, method, url, body,
headers):
body = self.fixtures.load('describe_instance_types.xml')
[03/11] libcloud git commit: Updated code so it's also compatible
with Python 2.6
Posted by to...@apache.org.
Updated code so it's also compatible with Python 2.6
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f9118e8d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f9118e8d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f9118e8d
Branch: refs/heads/trunk
Commit: f9118e8d62825e42fd155b387bcdf8472f089783
Parents: 386456c
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Wed Aug 30 18:22:52 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Wed Aug 30 18:22:52 2017 -0300
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f9118e8d/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 9737e13..f2526b0 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -3773,9 +3773,9 @@ class BaseEC2NodeDriver(NodeDriver):
params[tagspec_root + 'ResourceType'] = 'instance'
tag_nr = 1
for k, v in tags.items():
- tag_root = tagspec_root + "Tag.{}.".format(tag_nr)
- params[tag_root + "Key"] = k
- params[tag_root + "Value"] = v
+ tag_root = tagspec_root + 'Tag.%d.' % tag_nr
+ params[tag_root + 'Key'] = k
+ params[tag_root + 'Value'] = v
tag_nr += 1
object = self.connection.request(self.path, params=params).object
[11/11] libcloud git commit: Add tests for "_get_instance_vhd" method.
Posted by to...@apache.org.
Add tests for "_get_instance_vhd" method.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/91ea0911
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/91ea0911
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/91ea0911
Branch: refs/heads/trunk
Commit: 91ea09116afa5b5e969a6a2184c3a68fc192c485
Parents: 800f8d1
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:57:58 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 23:00:49 2017 +0200
----------------------------------------------------------------------
libcloud/test/compute/test_azure_arm.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/91ea0911/libcloud/test/compute/test_azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index 25c3e11..984feed 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -12,11 +12,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.import libcloud
+
import json
import sys
import functools
from datetime import datetime
+import mock
+
from libcloud.compute.base import (NodeLocation, NodeSize, VolumeSnapshot,
StorageVolume)
from libcloud.compute.drivers.azure_arm import AzureImage, NodeAuthPassword
@@ -379,6 +382,21 @@ class AzureNodeDriverTests(LibcloudTestCase):
res_value = snapshot.destroy()
self.assertTrue(res_value)
+ def test_get_instance_vhd(self):
+ with mock.patch.object(self.driver, '_ex_delete_old_vhd'):
+ # Default storage suffix
+ vhd_url = self.driver._get_instance_vhd(name='test1',
+ ex_resource_group='000000',
+ ex_storage_account='sga1')
+ self.assertEqual(vhd_url, 'https://sga1.blob.core.windows.net/vhds/test1-os_0.vhd')
+
+ # Custom storage suffix
+ self.driver.connection.storage_suffix = '.core.chinacloudapi.cn'
+ vhd_url = self.driver._get_instance_vhd(name='test1',
+ ex_resource_group='000000',
+ ex_storage_account='sga1')
+ self.assertEqual(vhd_url, 'https://sga1.blob.core.chinacloudapi.cn/vhds/test1-os_0.vhd')
+
class AzureMockHttp(MockHttp):
fixtures = ComputeFileFixtures('azure_arm')
[06/11] libcloud git commit: Accessing blob storage in alternate
cloud environments.
Posted by to...@apache.org.
Accessing blob storage in alternate cloud environments.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f33345cc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f33345cc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f33345cc
Branch: refs/heads/trunk
Commit: f33345cc00d1d2feeea5c6f680160104a8cc5bd1
Parents: bbd6d13
Author: Lucas Di Pentima <ld...@veritasgenetics.com>
Authored: Wed Sep 13 12:32:16 2017 -0300
Committer: Lucas Di Pentima <ld...@veritasgenetics.com>
Committed: Wed Sep 13 12:32:16 2017 -0300
----------------------------------------------------------------------
libcloud/compute/drivers/azure_arm.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f33345cc/libcloud/compute/drivers/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index ec71af4..f7e8a1b 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -538,9 +538,10 @@ class AzureNodeDriver(NodeDriver):
n = 0
while True:
try:
- instance_vhd = "https://%s.blob.core.windows.net" \
+ instance_vhd = "https://%s.blob%s" \
"/%s/%s-os_%i.vhd" \
% (ex_storage_account,
+ self.connection.storage_suffix,
ex_blob_container,
name,
n)
[10/11] libcloud git commit: Add changelog entry.
Posted by to...@apache.org.
Add changelog entry.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/800f8d1b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/800f8d1b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/800f8d1b
Branch: refs/heads/trunk
Commit: 800f8d1bdd968f84ea20c3f3874adc8d87c6318c
Parents: 2a8764b
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:50:59 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 22:51:25 2017 +0200
----------------------------------------------------------------------
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/800f8d1b/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 63d4a93..a0f9285 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -32,6 +32,10 @@ Compute
manner to finish faster.
[Tomaz Muraus]
+- Fix a regression in the Azure ARM driver which didn't allow custom storage
+ URI suffix to be used with create_node. (GITHUB-1110)
+ [Lucas Di Pentima]
+
Tests
~~~~~
[08/11] libcloud git commit: Add tests for custom storage suffix for
#1110.
Posted by to...@apache.org.
Add tests for custom storage suffix for #1110.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/91d14eaa
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/91d14eaa
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/91d14eaa
Branch: refs/heads/trunk
Commit: 91d14eaa0d54432e0b047e291279a4f6123314b1
Parents: ac321e0
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:41:22 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 22:41:22 2017 +0200
----------------------------------------------------------------------
libcloud/test/compute/test_azure_arm.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/91d14eaa/libcloud/test/compute/test_azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index eb2789e..25c3e11 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -43,6 +43,18 @@ class AzureNodeDriverTests(LibcloudTestCase):
self.driver = Azure(self.TENANT_ID, self.SUBSCRIPTION_ID,
self.APPLICATION_ID, self.APPLICATION_PASS)
+ def test_get_image(self):
+ # Default storage suffix
+ image = self.driver.get_image(image_id='http://www.example.com/foo/image_name')
+ self.assertEqual(image.id, 'https://www.blob.core.windows.net/foo/image_name')
+ self.assertEqual(image.name, 'image_name')
+
+ # Custom storage suffix
+ self.driver.connection.storage_suffix = '.core.chinacloudapi.cn'
+ image = self.driver.get_image(image_id='http://www.example.com/foo/image_name')
+ self.assertEqual(image.id, 'https://www.blob.core.chinacloudapi.cn/foo/image_name')
+ self.assertEqual(image.name, 'image_name')
+
def test_locations_returned_successfully(self):
locations = self.driver.list_locations()
self.assertEqual([l.name for l in locations],