diff --git a/doc/api_samples/os-user-data/userdata-post-req.json b/doc/api_samples/os-user-data/userdata-post-req.json deleted file mode 100644 index 255d14820a..0000000000 --- a/doc/api_samples/os-user-data/userdata-post-req.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "server" : { - "name" : "new-server-test", - "imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b", - "flavorRef" : "http://openstack.example.com/openstack/flavors/1", - "metadata" : { - "My Server Name" : "Apache1" - }, - "user_data" : "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==", - "personality" : [ - { - "path" : "/etc/banner.txt", - "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==" - } - ] - } -} \ No newline at end of file diff --git a/doc/api_samples/os-user-data/userdata-post-resp.json b/doc/api_samples/os-user-data/userdata-post-resp.json deleted file mode 100644 index 347095525e..0000000000 --- a/doc/api_samples/os-user-data/userdata-post-resp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "server": { - "adminPass": "bwQZtcB28c29", - "id": "55116d7b-2cad-4d65-9c7c-964cde61946e", - "links": [ - { - "href": "http://openstack.example.com/v2/openstack/servers/55116d7b-2cad-4d65-9c7c-964cde61946e", - "rel": "self" - }, - { - "href": "http://openstack.example.com/openstack/servers/55116d7b-2cad-4d65-9c7c-964cde61946e", - "rel": "bookmark" - } - ] - } -} \ No newline at end of file diff --git a/doc/v3/api_samples/os-user-data/userdata-post-resp.json b/doc/v3/api_samples/os-user-data/userdata-post-resp.json index aeeae8d86c..1022af2888 100644 --- a/doc/v3/api_samples/os-user-data/userdata-post-resp.json +++ b/doc/v3/api_samples/os-user-data/userdata-post-resp.json @@ -4,11 +4,11 @@ "id": "976a62bb-0d4a-4e17-9044-1864e888a557", "links": [ { - "href": "http://openstack.example.com/v3/servers/976a62bb-0d4a-4e17-9044-1864e888a557", + "href": "http://openstack.example.com/v2/openstack/servers/976a62bb-0d4a-4e17-9044-1864e888a557", "rel": "self" }, { - "href": "http://openstack.example.com/servers/976a62bb-0d4a-4e17-9044-1864e888a557", + "href": "http://openstack.example.com/openstack/servers/976a62bb-0d4a-4e17-9044-1864e888a557", "rel": "bookmark" } ] diff --git a/nova/tests/functional/api_samples/os-user-data/userdata-post-req.json.tpl b/nova/tests/functional/api_samples/os-user-data/userdata-post-req.json.tpl deleted file mode 100644 index fb7744a3d0..0000000000 --- a/nova/tests/functional/api_samples/os-user-data/userdata-post-req.json.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{ - "server" : { - "name" : "new-server-test", - "imageRef" : "%(host)s/openstack/images/%(image_id)s", - "flavorRef" : "%(host)s/openstack/flavors/1", - "metadata" : { - "My Server Name" : "Apache1" - }, - "user_data" : "%(user_data)s", - "personality" : [ - { - "path" : "/etc/banner.txt", - "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==" - } - ] - } -} diff --git a/nova/tests/functional/api_samples/os-user-data/userdata-post-resp.json.tpl b/nova/tests/functional/api_samples/os-user-data/userdata-post-resp.json.tpl deleted file mode 100644 index d5f030c873..0000000000 --- a/nova/tests/functional/api_samples/os-user-data/userdata-post-resp.json.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{ - "server": { - "adminPass": "%(password)s", - "id": "%(id)s", - "links": [ - { - "href": "%(host)s/v2/openstack/servers/%(uuid)s", - "rel": "self" - }, - { - "href": "%(host)s/openstack/servers/%(uuid)s", - "rel": "bookmark" - } - ] - } -} diff --git a/nova/tests/functional/test_api_samples.py b/nova/tests/functional/test_api_samples.py index 8f97d4d128..fca0859cad 100644 --- a/nova/tests/functional/test_api_samples.py +++ b/nova/tests/functional/test_api_samples.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import base64 import datetime import inspect import os @@ -257,23 +256,6 @@ class ServersActionsJsonTest(ServersSampleBase): {"password": "foo"}) -class UserDataJsonTest(ApiSampleTestBaseV2): - extension_name = "nova.api.openstack.compute.contrib.user_data.User_data" - - def test_user_data_post(self): - user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n' - user_data = base64.b64encode(user_data_contents) - subs = { - 'image_id': fake.get_valid_image_id(), - 'host': self._get_host(), - 'user_data': user_data - } - response = self._do_post('servers', 'userdata-post-req', subs) - - subs.update(self._get_regexes()) - self._verify_response('userdata-post-resp', subs, response, 202) - - class SecurityGroupsSampleJsonTest(ServersSampleBase): extension_name = "nova.api.openstack.compute.contrib" + \ ".security_groups.Security_groups" diff --git a/nova/tests/functional/v3/api_samples/os-user-data/userdata-post-resp.json.tpl b/nova/tests/functional/v3/api_samples/os-user-data/userdata-post-resp.json.tpl index adfaaa381e..d5f030c873 100644 --- a/nova/tests/functional/v3/api_samples/os-user-data/userdata-post-resp.json.tpl +++ b/nova/tests/functional/v3/api_samples/os-user-data/userdata-post-resp.json.tpl @@ -4,11 +4,11 @@ "id": "%(id)s", "links": [ { - "href": "%(host)s/v3/servers/%(uuid)s", + "href": "%(host)s/v2/openstack/servers/%(uuid)s", "rel": "self" }, { - "href": "%(host)s/servers/%(uuid)s", + "href": "%(host)s/openstack/servers/%(uuid)s", "rel": "bookmark" } ] diff --git a/nova/tests/functional/v3/test_user_data.py b/nova/tests/functional/v3/test_user_data.py index 482355a98e..dfacf27fb2 100644 --- a/nova/tests/functional/v3/test_user_data.py +++ b/nova/tests/functional/v3/test_user_data.py @@ -14,13 +14,26 @@ # under the License. import base64 +from oslo_config import cfg from nova.tests.functional.v3 import api_sample_base from nova.tests.unit.image import fake +CONF = cfg.CONF +CONF.import_opt('osapi_compute_extension', + 'nova.api.openstack.compute.extensions') + class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV3): extension_name = "os-user-data" + _api_version = 'v2' + + def _get_flags(self): + f = super(UserDataJsonTest, self)._get_flags() + f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] + f['osapi_compute_extension'].append( + 'nova.api.openstack.compute.contrib.user_data.User_data') + return f def test_user_data_post(self): user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'