tripleoclient unit tests read config from ~/undercloud.conf if exists

Bug #1803387 reported by Alex Schultz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Alex Schultz

Bug Description

If you have an undercloud.conf in your home directory when you run the unit tests it may be used to run the tests. This can lead to failures for example if you specify "undercloud_service_certificate = /etc/pki/instack-certs/undercloud.pem" in an ~/undercloud.conf the tests will fail with:

======================================================================
FAIL: tripleoclient.tests.v1.undercloud.test_undercloud.TestUndercloudInstall.test_undercloud_install_with_swift_encryption
tags: worker-1
----------------------------------------------------------------------
pythonlogging:'': {{{
Deprecated: Option "undercloud_public_vip" from group "DEFAULT" is deprecated. Use option "undercloud_public_host" from group "DEFAULT".
Deprecated: Option "inspection_iprange" from group "DEFAULT" is deprecated. Use option "inspection_iprange" from group "ctlplane-subnet".
Deprecated: Option "network_cidr" from group "DEFAULT" is deprecated. Use option "cidr" from group "ctlplane-subnet".
Deprecated: Option "network_gateway" from group "DEFAULT" is deprecated. Use option "gateway" from group "ctlplane-subnet".
Deprecated: Option "dhcp_start" from group "DEFAULT" is deprecated. Use option "dhcp_start" from group "ctlplane-subnet".
Deprecated: Option "dhcp_end" from group "DEFAULT" is deprecated. Use option "dhcp_end" from group "ctlplane-subnet".
Deprecated: Option "undercloud_admin_vip" from group "DEFAULT" is deprecated. Use option "undercloud_admin_host" from group "DEFAULT".
}}}

Traceback (most recent call last):
  File "/home/aschultz/Documents/workspace/tripleo/python-tripleoclient/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "tripleoclient/tests/v1/undercloud/test_undercloud.py", line 475, in test_undercloud_install_with_swift_encryption
    self.cmd.take_action(parsed_args)
  File "tripleoclient/v1/undercloud.py", line 128, in take_action
    dry_run=parsed_args.dry_run)
  File "tripleoclient/v1/undercloud_config.py", line 447, in prepare_undercloud_deploy
    CONF.get('undercloud_service_certificate')))
  File "tripleoclient/v1/undercloud_config.py", line 619, in _get_public_tls_parameters
    with open(service_certificate_path, "rb") as pem_file:
IOError: [Errno 2] No such file or directory: '/etc/pki/instack-certs/undercloud.pem'

summary: - tripleoclient unit tests reporting failure trying to access
- /etc/pki/instack-certs/undercloud.pem
+ tripleoclient unit tests read config from ~/undercloud.conf if exists
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/617992

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (master)

Reviewed: https://review.openstack.org/617992
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=ba9e16639fab485e63909a1036fab22901faa235
Submitter: Zuul
Branch: master

commit ba9e16639fab485e63909a1036fab22901faa235
Author: Alex Schultz <email address hidden>
Date: Wed Nov 14 08:27:40 2018 -0700

    Mock configuration load in unit tests

    Previously if you had an undercloud.conf in your home directory, the
    tests would load it and use values from it as the defaults for the tests
    if they were not overridden in the tests. This could lead to incorrect
    failures. This change mocks the config loading out from the install and
    upgrade actions for the undercloud to prevent this loading.

    Change-Id: I57a12f0151bc65f26a7e880b0f1f367a7711ead9
    Closes-Bug: #1803387

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 11.2.0

This issue was fixed in the openstack/python-tripleoclient 11.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.