doesn't emit logs when setting file permissions

Bug #1966825 reported by Yamato Tanaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Fix Released
Undecided
Yamato Tanaka

Bug Description

Description
===========

kolla sets file permissions at _set_properties() method, but no logs are emitted here.

https://github.com/openstack/kolla/blob/master/docker/base/set_configs.py#L93
~~~
    def _merge_directories(self, source, dest):
        if os.path.isdir(source):
            if os.path.lexists(dest) and not os.path.isdir(dest):
                self._delete_path(dest)
            if not os.path.isdir(dest):
                LOG.info('Creating directory %s', dest)
                os.makedirs(dest)
            self._set_properties(source, dest)
~~~

If the target file/directory already exist, kolla only copy permissions, but there will be no logs about the target file/directory

This issue can make it difficult to investigate the cause of issues which are caused by setting permissions.
For example, the following bug was caused by copying permissions from /var/lib/config-data/puppet-generated/keystone/etc/openldap to /etc/openldap, but investigation was difficult because _set_properties() doesn't emit any logs.

  https://bugs.launchpad.net/tripleo/+bug/1960781

How to reproduce it (minimal and precise):
==================
Run a container which contains kolla.
Then look at "podman/docker logs <container>"

Expected result
===============
Log messages are emitted when kolla tries to set file permissions like the example below
~~~
2022-02-14T12:23:55.396940406+09:00 stderr F INFO:__main__:Creating directory /etc/my.cnf.d
2022-02-14T12:23:55.396940406+09:00 stderr F INFO:__main__:Copying permissions /var/lib/kolla/config_files/src/etc/my.cnf.d to /etc/my.cnf.d
2022-02-14T12:23:25.397103106+09:00 stderr F INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/my.cnf.d/tripleo.cnf to /etc/my.cnf.d/tripleo.cnf
2022-02-14T12:23:55.397940406+09:00 stderr F INFO:__main__:Copying permissions /var/lib/kolla/config_files/src/etc/my.cnf.d/tripleo.cnf to /etc/my.cnf.d/tripleo.cnf
2022-02-14T12:23:55.397940406+09:00 stderr F INFO:__main__:Copying permissions /var/lib/config-data/puppet-generated/keystone/etc/openldap to /etc/openldap
~~~

Actual result
=============
a log message is emitted when kolla tries to set file permissions.
~~~
2022-02-14T12:23:55.396940406+09:00 stderr F INFO:__main__:Creating directory /etc/my.cnf.d
2022-02-14T12:23:25.397103106+09:00 stderr F INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/my.cnf.d/tripleo.cnf to /etc/my.cnf.d/tripleo.cnf
~~~

Environment
===========
this issue was found in a stable-train-based deployment (RHOSP16.1)

Logs & Configs
==============
Nothing

Changed in kolla:
assignee: nobody → Yamato Tanaka (yatanaka-1007)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kolla (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/kolla/+/835528

Changed in kolla:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla (master)

Reviewed: https://review.opendev.org/c/openstack/kolla/+/835528
Committed: https://opendev.org/openstack/kolla/commit/4c071fcc3a5efa01240602d6566035029fce2d5b
Submitter: "Zuul (22348)"
Branch: master

commit 4c071fcc3a5efa01240602d6566035029fce2d5b
Author: Yamato Tanaka <email address hidden>
Date: Tue Mar 29 11:35:12 2022 +0900

    Emit log when copying file/directory permissions

    Currently, kolla sets file permissions at _set_properties_from_file()
    method, but no logs are emitted here. This can make it
    difficult to investigate the cause of issues which are
    caused by setting permissions.
    This patch makes _set_properties_from_file() output a
    log.

    Closes-Bug: #1966825
    Change-Id: I91116931aa30fd2c5e51ed1ac04663fcfa4a5f36

Changed in kolla:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kolla (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/kolla/+/836601

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kolla (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/kolla/+/836602

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/kolla/+/836601
Committed: https://opendev.org/openstack/kolla/commit/cd58db65eaf669c31507d66d872d92913adafe6d
Submitter: "Zuul (22348)"
Branch: stable/xena

commit cd58db65eaf669c31507d66d872d92913adafe6d
Author: Yamato Tanaka <email address hidden>
Date: Tue Mar 29 11:35:12 2022 +0900

    Emit log when copying file/directory permissions

    Currently, kolla sets file permissions at _set_properties_from_file()
    method, but no logs are emitted here. This can make it
    difficult to investigate the cause of issues which are
    caused by setting permissions.
    This patch makes _set_properties_from_file() output a
    log.

    Closes-Bug: #1966825
    Change-Id: I91116931aa30fd2c5e51ed1ac04663fcfa4a5f36
    (cherry picked from commit 4c071fcc3a5efa01240602d6566035029fce2d5b)

tags: added: in-stable-xena
tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/kolla/+/836602
Committed: https://opendev.org/openstack/kolla/commit/5943f32af72ff62478bae63bdf93297984e9f809
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 5943f32af72ff62478bae63bdf93297984e9f809
Author: Yamato Tanaka <email address hidden>
Date: Tue Mar 29 11:35:12 2022 +0900

    Emit log when copying file/directory permissions

    Currently, kolla sets file permissions at _set_properties_from_file()
    method, but no logs are emitted here. This can make it
    difficult to investigate the cause of issues which are
    caused by setting permissions.
    This patch makes _set_properties_from_file() output a
    log.

    Closes-Bug: #1966825
    Change-Id: I91116931aa30fd2c5e51ed1ac04663fcfa4a5f36
    (cherry picked from commit 4c071fcc3a5efa01240602d6566035029fce2d5b)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla 14.0.0.0rc1

This issue was fixed in the openstack/kolla 14.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla 12.2.0

This issue was fixed in the openstack/kolla 12.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kolla 13.1.0

This issue was fixed in the openstack/kolla 13.1.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.