Bug 1623298 - foreman-debug issues when defining -d "different directory"
Summary: foreman-debug issues when defining -d "different directory"
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Foreman Debug
Version: 6.3.2
Hardware: All
OS: All
unspecified
high
Target Milestone: Unspecified
Assignee: Waldirio M Pinheiro
QA Contact: Lucie Vrtelova
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1619394
TreeView+ depends on / blocked
 
Reported: 2018-08-29 01:00 UTC by Waldirio M Pinheiro
Modified: 2021-12-10 17:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-04 06:09:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24950 0 Normal New foreman-debug issues when defining -d "different directory" 2020-07-14 06:46:19 UTC

Description Waldirio M Pinheiro 2018-08-29 01:00:40 UTC
Description of problem:
Actually when defining "-d <new path>" the file should be created on the specified directory. The file is created on the correct place but the point is, there isn't file name, just .<extension>

Version-Release number of selected component (if applicable):
6.3 / 6.4

How reproducible:
100%

Steps to Reproduce:
1. foreman-debug -d <new path>

Actual results:
A debug file has been created: /waldirio/.tar.xz (20168988 bytes)

Expected results:
A debug file has been created: /waldirio/foreman-debug.tar.xz (20168988 bytes)

Additional info:

Comment 3 Chris Roberts 2018-09-05 15:55:29 UTC
This is working as intended with the right syntax:

[root@centos7-katello-nightly /]# foreman-debug -d /test/foreman-debug
Processing... (takes a while)


 HOSTNAME: centos7-katello-nightly.vault111.example.com
       OS: redhat
  RELEASE: CentOS Linux release 7.5.1804 (Core) 
  FOREMAN: 1.20.0-develop
     RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
   PUPPET: 5.5.6
  DENIALS: 0


A debug file has been created: /test/foreman-debug.tar.xz (410380 bytes)

To upload a tarball to our secure site, please use the -u option.

Comment 5 Lukas Zapletal 2018-09-19 13:01:05 UTC
Waldirio, the problem is trailing slash not how this is designed. It works as expected unless you provide the trailing slash. Please rename the BZ, Issue and PR and provide fix for this if possible. Thanks for the report, analysis and patch!

BAD SCENARIO:

[root@next ~]# foreman-debug -d /tmp/test/
Processing... (takes a while)

 HOSTNAME: next.nat.lan
       OS: redhat
  RELEASE: Red Hat Enterprise Linux Server release 7.5 (Maipo)
  FOREMAN: 1.18.0.14
     RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
   PUPPET: 5.5.0
  DENIALS: 0


A debug file has been created: /tmp/test/.tar.xz (1873524 bytes)

To upload a tarball to our secure site, please use the -u option.

SUCCESS SCENARIO:

[root@next ~]# foreman-debug -d /tmp/test2
Processing... (takes a while)

 HOSTNAME: next.nat.lan
       OS: redhat
  RELEASE: Red Hat Enterprise Linux Server release 7.5 (Maipo)
  FOREMAN: 1.18.0.14
     RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
   PUPPET: 5.5.0
  DENIALS: 0


A debug file has been created: /tmp/test2.tar.xz (963620 bytes)

To upload a tarball to our secure site, please use the -u option.

Comment 6 Rafael Cavalcanti 2019-09-03 19:27:52 UTC
Hello all,

I would like to suggest something.
If this is working as expected and the problem is trailing slash, it would be a good idea to change the help description to something like:
Instead of:
----
- d DIR  Directory to place the tarball in (default /var/tmp/foreman-XYZ)
----
We could have:
----
-d Filename path to place the tarball in (default /var/tmp/foreman-XYZ)
----
Or even use '-f' rather than '-d'.

Another thing is, when we use -d, the script does not clean the temp dir as we can see below.
----
[root@sat65 katello-export]# foreman-debug -d /root/debug/foreman-debug
Processing... (takes a while)


 HOSTNAME: sat65.example.lab
       OS: redhat
  RELEASE: Red Hat Enterprise Linux Server release 7.7 (Maipo)
  FOREMAN: 1.20.1.35
     RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
   PUPPET: 5.5.12
  DENIALS: 18


A debug file has been created: /root/debug/foreman-debug.tar.xz (10535972 bytes)

To upload a tarball to our secure site, please use the -u option.
[root@sat65 katello-export]# ls /root/debug/
foreman-debug  foreman-debug.tar.xz
[root@sat65 katello-export]# ls /root/debug/foreman-debug/
bundle_list                  facts                            hammer-ping         iptables                  netstat                      ps-awfux               selinux_booleans           ulimit
cpuinfo                      foreman_auth_table               hornetq_disk_space  katello_pki_dir           passenger_memory             ps-elfm                selinux_denials.log        uname
date                         foreman_filecontexts             hostname_dns_check  katello_repositories      passenger_status_backtraces  pulp-running_tasks     selinux_fcontext           usr
db_table_size                foreman_hooks_list               hosts               katello_ssl_build_dir     passenger_status_pool        puppet_manifests_tree  selinux_first_denials.log  var
disk_space_output            foreman-maintain_service_status  http_proxy_var      lsb_release               passenger_status_requests    qpid_jrnl_disk_space   selinux_modules            version_puppet
dynflow_actions.csv          foreman_packages                 https_proxy_var     lsmod                     ping_hostname                qpid-stat-c            selinux_state              version_ruby
dynflow_execution_plans.csv  foreman_settings_table           ifconfig            meminfo                   ping_hostname_full           qpid-stat-q            skipped_files              virsh_list
dynflow_schema_info.csv      foreman_tasks_tasks.csv          installed_packages  mongodb_disk_space        ping_localhost               qpid-stat-u            software_collections
dynflow_steps.csv            gem_list                         ip_a                mongo-reserved_resources  postgres_disk_space          route                  ss
etc                          gem_list_scl                     ip_r                mongo-task_status         process_list                 selinux_audit2allow    tftpboot_tree
-----

However, if we use the default value(/var/tmp/), it does clean the temp dir.
-----
[root@sat65 katello-export]# foreman-debug 
Processing... (takes a while)


 HOSTNAME: sat65.example.lab
       OS: redhat
  RELEASE: Red Hat Enterprise Linux Server release 7.7 (Maipo)
  FOREMAN: 1.20.1.35
     RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
   PUPPET: 5.5.12
  DENIALS: 18


A debug file has been created: /var/tmp/foreman-debug-CxW87.tar.xz (10554008 bytes)

To upload a tarball to our secure site, please use the -u option.
[root@sat65 katello-export]# ls /var/tmp/
foreman-debug-CxW87.tar.xz
-----

Thanks,

Rafael

Comment 7 Lukas Zapletal 2019-09-04 06:09:09 UTC
We are in process of deprecating foreman-debug in favor of sosreport. In the new versions only sosreport will be recommended to gather all data - there is now a native satellite sos plugin available upstream. Since this is rather cosmetic issue, I am going to close this one unless someone is willing to provide a patch.


Note You need to log in before you can comment on or make changes to this bug.