summaryrefslogtreecommitdiff
path: root/tests/test_set_config.py
AgeCommit message (Collapse)AuthorFilesLines
2023-08-30Add comprehensive checks for container restartsDawud M1-0/+71
When adding a dashboard to grafana the containers aren't restarted when they should be. This is due to a bug in Kolla where the logic to determine whether or the container needs to be restarted fails in the case where the file does not exist in the container. This patch adds more comprehensive checks for container restarts in the set_configs.py file. This patch also adds a test to ensure that the functions work as expected. Closes-Bug: #1997984 Co-Authored-By: Will Szumski <will@stackhpc.com> Change-Id: I67f5f12700d7b55f26bff81e9b54559303da6d83 (cherry picked from commit d9a6c5f3901e078a30d341397ac57d867d8191cc)
2022-08-29Fix CVE-2022-38060Radosław Piliszek1-18/+0
Closes-Bug: #1985784 Change-Id: I66476a2b396e2cbe41e68ac51f57aae1806b2ed8
2021-02-10Make kolla_set_configs open files in binary modeRadosław Piliszek1-0/+23
This fixes comparisons when files are not Unicode-encoded. A relevant unit test is included. It can be used as a base for other _cmp_file method unit tests if the need arises. Change-Id: Ic638516eb92d24ad247a7866fd1b5e2ac0400388 Closes-Bug: #1913952
2021-01-25Remove two missed unicode flagsRadosław Piliszek1-2/+2
Change-Id: I799bf8edfef6ff68382d651dca6de96fa80ed733
2020-08-30Update imp module to importlibzhoulinhui1-2/+12
The imp module is deprecated[1] since version 3.4, use importlib to instead 1: https://docs.python.org/3/library/imp.html Change-Id: I79dfd923531dd3e00d23e1682865f56f0cf437d2
2020-08-28Fix kolla_set_configs --check with a directoryMark Goddard1-0/+41
There are several issues with kolla_set_configs --check: 1. We calculate the destination path incorrectly when comparing a file in a directory, due to passing arguments to os.path.relpath in the wrong order 2. For directories that have not changed, we also attempt to compare them as files, which fails when they are open()ed. 3. If the config JSON does not have a config_files key, it fails with a KeyError. The first two issues affect the fluentd container, which specifies directories as the source, without using a glob. The third affects OVN containers. This patch fixes these issues. Closes-Bug: #1890567 Change-Id: I8921befe51da4282121443849177a7ca5ebe8822
2020-04-03Merge "Update hacking for Python3"Zuul1-0/+1
2020-04-02Use unittest.mock instead of PyPI mockRadosław Piliszek1-1/+1
Now that py2 is gone, oslotest dropped dependency on mock and will soon affect Ussuri CI [1], let's use unittest.mock built in py3. This also fixes py38 jobs and proactively prevents py36 and py37 failing due to [1]. This is because we never included mock in test-requirements (but in lower-constraints where it does not really belong at all) and instead relied on oslotest to bring it in. [1] https://review.opendev.org/716322 Change-Id: Iceedcc7ad0d087414f6f94dfc0235fda4754be63
2020-04-01Update hacking for Python3Andreas Jaeger1-0/+1
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found by updated hacking version. Update local hacking checks for new flake8. Remove hacking and friends from lower-constraints, they are not needed in installations. Change-Id: I67e5ca24c550163c218fb06692de0b7c528d8318
2017-07-06Make set_configs.py work with symlinksMartin André1-9/+9
Closes-Bug: #1702305 Change-Id: I92a404b8d301937dc1847d42576e30db43951990
2017-07-02Fix argument to handle_permissionsChulmin Kang1-3/+4
Fix the format of argument passed to handle_permissions function, so that handle_permissions can handle permissions and ownerships of config_files. Change-Id: Ic07975a16973df22cdaa6685fc326620812f8f65 Closes-Bug: #1701876
2017-06-27Introduce merge and preserve_properties for config_filesMartin André1-9/+28
The `merge` option will basically copy all the files recursively inside the container without removing the existing files or directory, while the `preserve_properties` option keeps the file attributes (permissions, ownership, timestamps) in the container. This is useful if you have extracted some config files from a container and want to use them in another container based on the same image. This makes TripleO usage of Kolla much more robust. Change-Id: I78dcec741a941dc21adba33ba33a6dc6ff1d217c
2017-06-21Allow setting copied files group more preciselyMartin André1-13/+5
Previously with the config_files structure of config.json, the group name was automatically set to the one of the user name. It is now possible to set the group name in the same fashion than the 'permissions' structure with: owner: 'desired_owner:desired_group' Closes-Bug: #1696095 Change-Id: Ibae9f74e2351c81a717294467aedc51ea773c41e
2017-01-18Fix the set config errorJeffrey Zhang1-0/+211
* fix wrong handle for directory * refactor the code Closes-Bug: #1563741 Change-Id: I83869e074cb2924f1c5b49a67e57aefef623a8b0
2016-05-02Remove dependencies on kazoo and friendsSteven Dake1-58/+0
Since kolla-mesos has been retired, there is no need in the code base to keep the zookeeper implementation. As a result, just remove it. If we were to keep it we need virtualenvs for that part of the code base which installs the python dependencies related to it for from-binary installs. This just simplifies the implementation tremendously and culls dead code. Change-Id: Ieda226e652d67f5b5667112f4f2556f3171366d3 Closes-Bug: #1577194
2016-02-27Reconfigure keystone serviceJeffrey Zhang1-2/+4
Partially-implements: bp kolla-reconfig Change-Id: Ied293e59bf4531e88a0e5e5bf9a5f5f495d2a0e7
2016-01-13Add py27 py34 pypy unittestJeffrey Zhang1-3/+3
Change-Id: Iaf58463bd156924839062b8284a2d7151a153db5
2015-12-02Add support for copying files from a "zk://" sourceAngus Salkeld1-0/+58
Co-Authored-By: Michal Rostecki <mrostecki@mirantis.com> Implements: blueprint zookeeper Change-Id: I176f063d3802716846b921e210c1569d28bd90d8
2015-11-17Add support for loading kolla config from ENVAngus Salkeld1-0/+17
Implements: blueprint zookeeper Change-Id: Ibabcb5d6d304be9290633338c513f16651d4479a
2015-11-10Add a test case for load_configAngus Salkeld1-0/+47
This is just a basic test to make sure loading from file works. Change-Id: I074f36023ac4198c436fcee1668d32f9d1f0e61b