Fix docker start failed in guest-agent
docker_insecure_registries is a StrOpt, but the default value is '[]' which is true for a string. Change-Id: I4b8841cc77324f274bc8210d328bc42ddef5d056
This commit is contained in:
parent
d126aacf90
commit
54c2579a35
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix docker start failed in trove guest-agent when
|
||||
docker_insecure_registries is not set.
|
@ -449,8 +449,8 @@ common_opts = [
|
||||
'the datastores supported by Trove.'),
|
||||
cfg.StrOpt('docker_bridge_network_ip', default=None,
|
||||
help='Docker bridge network IP.'),
|
||||
cfg.StrOpt('docker_insecure_registries', default=[],
|
||||
help='Docker insecure registries for image development.'),
|
||||
cfg.ListOpt('docker_insecure_registries', default=[],
|
||||
help='Docker insecure registries for image development.'),
|
||||
cfg.StrOpt('template_path', default='/etc/trove/templates/',
|
||||
help='Path which leads to datastore templates.'),
|
||||
cfg.BoolOpt('sql_query_logging', default=False,
|
||||
|
@ -1046,7 +1046,7 @@ class BaseInstance(SimpleInstance):
|
||||
docker_daemon_values["bip"] = CONF.docker_bridge_network_ip
|
||||
if CONF.docker_insecure_registries:
|
||||
docker_daemon_values["insecure-registries"] = \
|
||||
CONF.docker_insecure_registries.split(',')
|
||||
CONF.docker_insecure_registries
|
||||
|
||||
if docker_daemon_values:
|
||||
files['/etc/docker/daemon.json'] = (
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 json
|
||||
import os
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
@ -257,6 +258,8 @@ class FreshInstanceTasksTest(BaseFreshInstanceTasksTest):
|
||||
cfg.CONF.set_override('guest_config', self.guestconfig)
|
||||
cfg.CONF.set_override('guest_info', 'guest_info.conf')
|
||||
cfg.CONF.set_override('injected_config_location', '/etc/trove/conf.d')
|
||||
cfg.CONF.set_override('docker_insecure_registries',
|
||||
'127.0.0.1:4000,127.0.0.1:5000')
|
||||
|
||||
# execute
|
||||
files = self.freshinstancetasks.get_injected_files("test", 'test')
|
||||
@ -268,6 +271,9 @@ class FreshInstanceTasksTest(BaseFreshInstanceTasksTest):
|
||||
self.assertEqual(
|
||||
self.guestconfig_content,
|
||||
files['/etc/trove/conf.d/trove-guestagent.conf'])
|
||||
deamon_json = json.loads(files.get('/etc/docker/daemon.json'))
|
||||
self.assertIn('127.0.0.1:4000', deamon_json.get('insecure-registries'))
|
||||
self.assertIn('127.0.0.1:5000', deamon_json.get('insecure-registries'))
|
||||
|
||||
@patch.object(DBInstance, 'get_by')
|
||||
def test_create_instance_guestconfig_compat(self, patch_get_by):
|
||||
@ -285,6 +291,7 @@ class FreshInstanceTasksTest(BaseFreshInstanceTasksTest):
|
||||
self.assertEqual(
|
||||
self.guestconfig_content,
|
||||
files['/etc/trove-guestagent.conf'])
|
||||
self.assertFalse(files.get('/etc/docker/daemon.json'))
|
||||
|
||||
def test_create_instance_with_az_kwarg(self):
|
||||
# execute
|
||||
|
Loading…
Reference in New Issue
Block a user