Fix applying OPENSTACK_SERVER_DEFAULT_USER_DATA value

The final revision of I86ac21bf82c1667135abd4f20fb4514da0899450 is buggy
and doesn't work.
This commit fixes it and adds a proper test.

Also, this commit updates the docs with a proper horizon version that
corresponds to Zed release (the feature was introduced before final Zed
cut so the author tried to guess the final release number).

Change-Id: Id921b69df13af3cc209236f0446d82dd30e4d8a2
This commit is contained in:
Andrey Kurilin 2022-12-19 13:54:25 +01:00
parent 5307672367
commit c8ee8c1965
4 changed files with 18 additions and 7 deletions

View File

@ -2184,7 +2184,7 @@ LAUNCH_INSTANCE_DEFAULTS
Added the ``default_availability_zone`` option.
.. versionchanged:: 22.3.0(Zed)
.. versionchanged:: 23.0.0(Zed)
Added the ``enable_metadata``, ``enable_net_ports`` options.
@ -2293,7 +2293,7 @@ launching an instance.
enable_metadata
###############
.. versionadded:: 22.3.0(Zed)
.. versionadded:: 23.0.0(Zed)
Default: ``True``
@ -2303,7 +2303,7 @@ an instance.
enable_net_ports
################
.. versionadded:: 22.3.0(Zed)
.. versionadded:: 23.0.0(Zed)
Default: ``True``
@ -2329,7 +2329,7 @@ is specified.
OPENSTACK_SERVER_DEFAULT_USER_DATA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 22.3.0(Zed)
.. versionadded:: 23.0.0(Zed)
Default: ``""``

View File

@ -252,7 +252,7 @@
});
settings.getSetting("OPENSTACK_SERVER_DEFAULT_USER_DATA").then(
function (response) {
model.newInstanceSpec.default_user_data = response.OPENSTACK_SERVER_DEFAULT_USER_DATA;
model.newInstanceSpec.default_user_data = response;
});
promise = $q.all([

View File

@ -188,8 +188,7 @@
disable_volume_snapshot: false,
default_availability_zone: 'Any'
},
DEFAULT_BOOT_SOURCE: 'image',
OPENSTACK_SERVER_DEFAULT_USER_DATA: ''
DEFAULT_BOOT_SOURCE: 'image'
};
IMAGE = {type: 'image', label: 'Image', selected: true};
VOLUME = {type: 'volume', label: 'Volume', selected: false};
@ -557,6 +556,13 @@
expect(model.newInstanceSpec.hide_create_volume).toBe(true);
});
it('should default user_data based on setting', function() {
settings.OPENSTACK_SERVER_DEFAULT_USER_DATA = 'default-data';
model.initialize(true);
scope.$apply();
expect(model.newInstanceSpec.default_user_data).toBe('default-data');
});
it('should not set availability zone if the zone list is empty', function () {
spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () {
var deferred = $q.defer();

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixes the bug where an administrator could not specify default user_data
for new VMs via ``OPENSTACK_SERVER_DEFAULT_USER_DATA`` configuration
setting.