Files
utilities/tools/collector
Tim Rose 2cef5fdb0d Add pre-bootstrap support for collect
Prior to the Bootstrap phase completing the current user (e.g sysadmin)
cannot create files due to the permissions on the /scratch directory
and missing sys_protected group membership.

The fix ensures that newly created files or directories can be
created by creating them with "sudo" and then changing the owner
to the current user.

Test Plan:

On AIO-SX where Bootstrap Failed:

  PASS:- collect
  PASS:- collect --clean
  PASS:- collect --name joe
  PASS:- collect --report
  PASS:- collect --verbose
  PASS:- collect --debug
  PASS:- collect --start-date 20250530 --end-date 20250602
  PASS:- collect --skip-mask --omit-certs
  PASS:- report.py -f /scratch/<bundle name>.tar <-- but requires sudo
     otherwise "Permission Error: Bundle dir not writable: /scratch"
	 occurs

  PASS:- report.py -d /scratch    -- ditto --
  FAIL:- collect - with passwd containing \,@,", and $  <-- failed for
      backslash character; Bug https://bugs.launchpad.net/starlingx/+bug/2116211 submitted
  PASS:- collect --file - where file contains passwd
  PASS:- collect - with passwordless sudo
  PASS:- collect - with user account without sudo privileges
  PASS:- collect - with /scratch filled up

On successfully running AIO-DX:

  PASS:- collect
  PASS:- collect - inactive controller
  PASS:- collect --clean
  PASS:- collect all --name joe
  PASS:- collect --list controller-0 controller-1
  PASS:- collect all --report
  PASS:- collect all --verbose --inline
  PASS:- collect --debug
  PASS:- collect all --timeout <minutes> --inventory
     --name <bundle name> --start-date <yyyymmdd>
  PASS:- collect all --subcloud
  PASS:- report.py -f /scratch/<bundle name>.tar
  PASS collect all - with passwd containing @,", and $
  PASS:- collect all - with passwordless sudo, standby controller
     <-- standby failed; active succeeded
  PASS:- collect all - with user account without sudo privileges, active controller
  PASS:- collect all - non-sysadmin user with sudo privileges.
  PASS:- collect - with local /scratch filled up
  PASS:- collect - with remote /scratch filled up

Closes-Bug: https://bugs.launchpad.net/starlingx/+bug/2113471
Change-Id: I607199786a9bfdb4589bfecb8bca4ce992da975b
Signed-off-by: Tim Rose <kevin.rose@windriver.com>
2025-07-14 14:15:03 -04:00
..