Reimplement mkdir -p reporting where permissions break down#228
Reimplement mkdir -p reporting where permissions break down#228
mkdir -p reporting where permissions break down#228Conversation
This will allow us to log where creating directory structures under `host_injections` is breaking down.
|
Rate limits are an issue with our PRs, see https://github.com/EESSI/software-layer/actions/runs/4175759364/jobs/7231122992#step:4:32 |
| function create_directory_structure() { | ||
| # Ensure we are given a single path argument | ||
| if [ $# -ne 1 ]; then | ||
| echo "Function requires a single (relative or absolute) path argument" >&2 |
There was a problem hiding this comment.
Function -> create_directory_structure
| echo "Function requires a single (relative or absolute) path argument" >&2 | |
| echo "ERROR: create_directory_structure requires a single (relative or absolute) path argument" >&2 |
| # Nothing to be done | ||
| return 0 | ||
| else | ||
| echo "Directory ${directory_structure} exists but is not writeable" >&2 |
There was a problem hiding this comment.
| echo "Directory ${directory_structure} exists but is not writeable" >&2 | |
| echo "ERROR: Directory ${directory_structure} exists but is not writeable" >&2 |
| return 0 | ||
| else | ||
| echo "Directory ${directory_structure} exists but is not writeable" >&2 | ||
| return 1 |
There was a problem hiding this comment.
Do we want different exit codes for different types of failures?
| # If the parent doesn't exist we need to create it | ||
| if [ ! -d "${directory_structure_parent}" ]; then | ||
| # Create the parent via a recursive call to this function | ||
| # (if this doesn't succeed we need to return the error code) |
There was a problem hiding this comment.
We're not returning the error code of the recursive call at all?
| return 0 | ||
| fi | ||
| else | ||
| echo "Attempt to create ${full_structure} failed," \ |
There was a problem hiding this comment.
| echo "Attempt to create ${full_structure} failed," \ | |
| echo "ERROR: Attempt to create ${full_structure} failed," \ |
| unset full_structure | ||
| fi | ||
| if ! mkdir "${directory_structure}"; then | ||
| echo "'mkdir ${directory_structure}' failed for an unknown reason!" >&2 |
There was a problem hiding this comment.
| echo "'mkdir ${directory_structure}' failed for an unknown reason!" >&2 | |
| echo "'ERROR: mkdir ${directory_structure}' failed for an unknown reason!" >&2 |
| return 1 | ||
| fi | ||
|
|
||
| # set a persistent variable that knows the full structure |
There was a problem hiding this comment.
| # set a persistent variable that knows the full structure | |
| # set a persistent global variable that knows the full structure |
| fi | ||
| } | ||
|
|
||
| # Reimplement 'mkdir -p' with reporting on where permissions break down |
There was a problem hiding this comment.
@ocaisa Maybe it makes sense to elaborate on the use case for this function a bit?
Why is mkdir -p not good enough, is it mainly to get better error reporting?
Can we add a reference to an issue on something here with more info?
|
Urgh, I'm going to close this. |
…_step_scripts dummy scripts for job step to test software build
This will allow us to log where creating directory structures under
host_injectionsis breaking down.