We use mimetypes to set file mime types for upload to log server
locations. We also override yaml files mime type to text/plain when
doing so. If we then call mimetypes.init() again this overrides the
previous yaml update to text/plain. This wasn't a problem until
python3.12 but python3.12 (on Ubuntu Noble specifically) seems to import
test cases in a different order which results in the mimetypes.init()
call in generate_manifest.py overriding the yaml mimetype set by the log
upload test cases.
Simply check if mimetypes is already inited before we init it again
which should avoid the problem entirely.
Note that this is likely to only ever by a testing issues as typically
ansible wouldn't import all of this code together but the unittest
runner does.
Change-Id: Ifb9137ddd89713cad546129c462ad94315100940
This commit in Ansible:
9142be2f6c
now allows Python modules to specify their interpreter with the shebang.
We expect our roles to use the discovered python interpreter on remote
nodes, and on the executor, we need them to use the virtualenv. Removing
the specific shebang accomplishes this under Ansible 6, and has no effect
under older versions of Ansible.
Without this, for example, the log upload roles would not have access to
their cloud libraries.
Also update our ansible/cli check in our module files. Many of our modules
can be run from the command line for ease of testing, but the check that we
perform to determine if the module is being invoked from the command line
or Ansible fails on Ansible 5. Update it to a check that should work in
all 4 versions of Ansible that Zuul uses.
Change-Id: I4e6e85156459cca032e6c3e1d8a9284be919ccca
When checking out repo to Windows environment, some files in test
fixture file trees do not get checked out. By setting renaming those
files with an urlencoded name, and populating a temporary directory
with corresponding file structure and decoded filenames during test by
a fixtures script, this will not cause checkout problems for those who
want to read the repo in Win environment
Change-Id: If354eaf3f0bf2e86ddc05e3750aa5f0067dd9e21
These aren't all getting cleaned up, which winds up breaking
the second runs. Instead of doing addCleanup with a method that
does the loop again, which can fail in the middle and not
clean up subsequent files, add an individual cleanup when we
add the symlink. This results in all of the symlinks consistently
being cleaned.
Change-Id: Id5a5b09c830ad2ad3bb0b77fb9dbdc494c629824
This allows a deployer to indicate that they prefer the Zuul
dashboard to link to "dir/index.html" rather than just "/dir" when
displaying directory entries in the log browser. This helps with
log storage systems which do not automatically serve index.html
files at directory urls.
Change-Id: I0444798c689667e51d8761a20b661f8a9b90323d
There may be broken symlinks within the log directories, those fail with
an error when os.stat() is executed on them. Let's just skip those.
Change-Id: I3e6982c53a08f57ac0e592b8a0041bbb39812d1f