diff --git a/cloud-init-direxist.patch b/cloud-init-direxist.patch new file mode 100644 index 0000000..2c73db2 --- /dev/null +++ b/cloud-init-direxist.patch @@ -0,0 +1,24 @@ +--- cloudinit/atomic_helper.py.orig ++++ cloudinit/atomic_helper.py +@@ -7,6 +7,8 @@ import stat + import tempfile + from base64 import b64decode, b64encode + ++from cloudinit import util ++ + _DEF_PERMS = 0o644 + LOG = logging.getLogger(__name__) + +@@ -43,9 +45,9 @@ def write_file( + + tf = None + try: +- tf = tempfile.NamedTemporaryFile( +- dir=os.path.dirname(filename), delete=False, mode=omode +- ) ++ dirname = os.path.dirname(filename) ++ util.ensure_dir(dirname) ++ tf = tempfile.NamedTemporaryFile(dir=dirname, delete=False, mode=omode) + LOG.debug( + "Atomically writing to file %s (via temporary file %s) - %s: [%o]" + " %d bytes/chars", diff --git a/cloud-init.changes b/cloud-init.changes index 17f8525..c624d10 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Feb 4 16:44:12 UTC 2025 - Robert Schweikert + +- Add cloud-init-direxist.patch (bsc#1236720) + + Make sur ethe directory exists, if not create it, before writing in that + location. + ------------------------------------------------------------------- Mon Jan 20 14:21:55 UTC 2025 - Daniel Garcia diff --git a/cloud-init.spec b/cloud-init.spec index 9cb0042..2213ff7 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -61,6 +61,8 @@ Patch17: pep-594-drop-pipes.patch Patch18: cloud-init-fix-python313.patch # FIXME https://github.com/canonical/cloud-init/pull/5052 Patch19: cloud-init-dont-assume-ordering-of-ThreadPoolExecutor.patch +# FIXME https://github.com/canonical/cloud-init/pull/4938 +Patch20: cloud-init-direxist.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -178,6 +180,7 @@ Documentation and examples for cloud-init tools %patch -p1 -P 17 %patch -p1 -P 18 %patch -p1 -P 19 +%patch -P 20 # patch in the full version to version.py version_pys=$(find . -name version.py -type f)