Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sap_swpm: Argument list can be too long when setting file permissions #721

Open
berndfinger opened this issue Apr 18, 2024 · 3 comments
Open
Assignees

Comments

@berndfinger
Copy link
Member

In the task

- name: SAP SWPM Pre Install - Ensure correct permissions and ownership of all non-SAPCAR files # noqa command-instead-of-module no-changed-when
, the error [Errno 7] Argument list too long: '/bin/sh' can occur if there are a lot of files (e.g. more than 683) in the __sap_swpm_fact_files_non_sapcar_chown_arg_list. This can happen if there are directories with many extracted files in sap_swpm_software_path, e.g. from a previous installation.

Workaround: Skip setting file permissions and ownership by setting role parameter sap_swpm_set_file_permissions to false, or ensure there are no directories in sap_swpm_software_path with files which are not needed for the SWPM installation.

See also #663.

@berndfinger
Copy link
Member Author

We could just skip all the *extracted* directories when setting file permissions and ownership. At the time when the file and directory permissions are set by the role, permissions and ownership only of files which are not already extracted will have to be modified.

berndfinger added a commit to berndfinger/community.sap_install that referenced this issue May 8, 2024
Solves issue sap-linuxlab#721.

Signed-off-by: Bernd Finger <bfinger@redhat.com>
@berndfinger berndfinger self-assigned this Jun 7, 2024
@marcelmamula
Copy link
Contributor

@berndfinger I would suggest different approach. It is easier to create batches of 100 files and run them in loop.

This is short example I made for test, which splits into batches of 3:

  vars:
    file_input: "fileA fileB fileC fileD fileE fileF fileG fileX"
  tasks:
    - name: Assign file_input into file_list
      ansible.builtin.set_fact:
        file_list: "{{ file_input.split(' ') }}"

    - name: Show file_list in loop per batch
      ansible.builtin.debug:
        msg: "{{ item | join(' ') }}"
      loop: "{{ file_list | batch(3) }}"
      loop_control:
        label: "Batch {{ (file_list.index(item[0]) // 3) + 1 }}"
TASK [Show file_list in loop per batch] *********************************************************************************************************************
ok: [localhost] => (item=Batch 1) => {
    "msg": "fileA fileB fileC"
}
ok: [localhost] => (item=Batch 2) => {
    "msg": "fileD fileE fileF"
}
ok: [localhost] => (item=Batch 3) => {
    "msg": "fileG fileX"
}

@berndfinger
Copy link
Member Author

@marcelmamula Nice idea, thanks! I tested with a batch size of 100, a directory name of length 100, and several 1000 files with a 22 character file name. I would still skip the extracted directories, as there should never be any need to change owners and permissions of extracted files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants