Project

General

Profile

Actions

Bug #18365

open

foreman-answers.yaml from /usr/share stored instead of /etc/foreman-installer

Added by Dominic Cleal almost 8 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
foreman-debug
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Since Foreman 1.14, foreman-debug is storing an incorrect version of the file in the tarball at etc/foreman-installer/scenarios.d/foreman-answers.yaml.

Originals:

# ls -l /etc/foreman-installer/scenarios.d/foreman-answers*
-rw-------. 1 root root 14016 Feb  2 04:18 /etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-------. 1 root root  2111 Jan 25 22:30 /etc/foreman-installer/scenarios.d/foreman-answers.yaml.rpmnew

With nightly:

# ls -l /tmp/foreman-debug-Owysl/etc/foreman-installer/scenarios.d/foreman-answers*
-rw-r--r--. 1 root root 2111 Feb  2 05:00 /tmp/foreman-debug-Owysl/etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-r--r--. 1 root root 2111 Feb  2 05:00 /tmp/foreman-debug-Owysl/etc/foreman-installer/scenarios.d/foreman-answers.yaml.rpmnew

With 1.13.4:

# ls -l /tmp/foreman-debug-g68Ro/etc/foreman-installer/scenarios.d/foreman-answers*
-rw-r--r--. 1 root root 13959 Feb  2 04:59 /tmp/foreman-debug-g68Ro/etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-r--r--. 1 root root  2111 Feb  2 04:59 /tmp/foreman-debug-g68Ro/etc/foreman-installer/scenarios.d/foreman-answers.yaml.rpmnew

Debugging shows that the add_files() find command is probably traversing through /etc/foreman-installer/scenarios.d/foreman.migrations/.. as add_files is called with /etc/foreman-installer/scenarios.d/*/.* and foreman.migrations is a symlink to /usr/share/foreman-installer/config/foreman.migrations.

add_files then stores /usr/share/foreman-installer/config/foreman-answers.yaml, replacing the file of the same name.


Files

foreman-debug foreman-debug 12.2 KB foreman-debug (at bed4594) Dominic Cleal, 05/22/2017 04:56 AM
foreman-debug.out foreman-debug.out 18.1 KB output from foreman-debug -v -g -a -d /tmp/fd2 Dominic Cleal, 05/22/2017 04:57 AM

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #17044: foreman-debug to collect whole newest (log)files instead of tailing all (log)filesClosedPavel Moravec09/24/2016Actions
Actions #1

Updated by Dominic Cleal almost 8 years ago

  • Related to Bug #17044: foreman-debug to collect whole newest (log)files instead of tailing all (log)files added
Actions #2

Updated by Dominic Cleal almost 8 years ago

  • Translation missing: en.field_release changed from 221 to 227
Actions #3

Updated by Dominic Cleal over 7 years ago

  • Translation missing: en.field_release deleted (227)
Actions #4

Updated by Anurag Patel over 7 years ago

  • Assignee set to Anurag Patel

I was unable to replicate this issue. By looking at their sizes, it seems like not much has changed within.

[root@bb8 ~]# ls -l /etc/foreman-installer/scenarios.d/foreman-answers*
-rw-------. 1 root root 12956 Dec  6 21:29 /etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-------. 1 root root  1780 Nov 25 21:16 /etc/foreman-installer/scenarios.d/foreman-answers.yaml.rpmnew
[root@bb8 ~]# ls -l /tmp/fd1/etc/foreman-installer/scenarios.d/foreman-answers*
-rw-r--r--. 1 root root 12840 Dec  6 21:29 /tmp/fd1/etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-r--r--. 1 root root  1780 Nov 25 21:16 /tmp/fd1/etc/foreman-installer/scenarios.d/foreman-answers.yaml.rpmnew
[root@bb8 ~]# 

The sample foreman-answers file present in /usr/share/foreman-installer/config remains a smaller size example.

[root@bb8 ~]# ls -l /usr/share/foreman-installer/config/foreman-answers*
-rw-r--r--. 1 root root 1780 Jan 26 12:37 /usr/share/foreman-installer/config/foreman-answers.yaml
[root@bb8 ~]# 

By doing a diff too, the only thing that changes between the two files is string filtering applied by foreman-debug.

[root@bb8 ~]# diff /etc/foreman-installer/scenarios.d/foreman-answers.yaml /tmp/fd1/etc/foreman-installer/scenarios.d/foreman-answers.yaml
40c40
<   db_password: <removed-by-gnurag>
---
>   db_password: +FILTERED+
70,71c70,71
<   oauth_consumer_key: <removed-by-gnurag>
<   oauth_consumer_secret: <removed-by-gnurag>
---
>   oauth_consumer_key: +FILTERED+
>   oauth_consumer_secret: +FILTERED+
76c76
<   admin_password: <removed-by-gnurag>
---
>   admin_password: +FILTERED+
235,236c235,236
<   oauth_consumer_key: <removed-by-gnurag>
<   oauth_consumer_secret: <removed-by-gnurag>
---
>   oauth_consumer_key: +FILTERED+
>   oauth_consumer_secret: +FILTERED+
[root@bb8 ~]# 

I suspect something may have changed in foreman-debug's add_files function because of which it isn't traversing .. directory.

Actions #5

Updated by Dominic Cleal over 7 years ago

This remains reproducible on two separate nightly package installations (at fcb0e4b):

# ls -l /usr/share/foreman-installer/config/foreman-answers.yaml /etc/foreman-installer/scenarios.d/foreman-answers.yaml 
-rw-------. 1 root root 14347 May 15 09:28 /etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-r--r--. 1 root root  2158 May 14 23:52 /usr/share/foreman-installer/config/foreman-answers.yaml
# ll foreman-debug-Ey0R6/etc/foreman-installer/scenarios.d/foreman-answers.yaml
-rw-r--r--. 1 root root 2158 May 14 23:52 foreman-debug-Ey0R6/etc/foreman-installer/scenarios.d/foreman-answers.yaml
Actions #6

Updated by Anurag Patel over 7 years ago

Dominic Cleal wrote:

This remains reproducible on two separate nightly package installations (at fcb0e4b):

[...]

I was trying out from latest develop, also tested it out from fcb0e4bbe90d4c35fe1810d8e0cfd3bea3302324 - it worked as expected for me:

$ sudo ./script/foreman-debug -v -g -a -d /tmp/fd2

Would it be possible to gist the installed foreman-debug script?

Updated by Dominic Cleal over 7 years ago

Attached the unaltered script from the package and the output of the command you listed above, which shows the inclusion of /etc/foreman-installer/scenarios.d/foreman.migrations/../foreman-answers.yaml as per the description.

-rw-r--r-- 1 root root 2158 May 19 03:26 /tmp/fd2/etc/foreman-installer/scenarios.d/foreman-answers.yaml
Actions #8

Updated by Anurag Patel over 7 years ago

Dominic Cleal wrote:

Attached the unaltered script from the package and the output of the command you listed above, which shows the inclusion of /etc/foreman-installer/scenarios.d/foreman.migrations/../foreman-answers.yaml as per the description.

[...]

Thanks Dominic. I wasn't able to quickly verify this earlier because in my case foreman-debug was copying symlink/.. file first, and the correct file afterward. But the debug mode confirms this as a bug.

Any suggestion on fixing this? Would skipping .. in any of the directory listing loop help, or would it have side effects?

Actions

Also available in: Atom PDF