- Add cloud-init-direxist.patch (bsc#1236720)

+ Make sur ethe directory exists, if not create it, before writing in that
    location.

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=242
This commit is contained in:
Robert Schweikert 2025-02-04 16:57:48 +00:00 committed by Git OBS Bridge
parent ae07dd3a29
commit 1a0cecdf92
3 changed files with 34 additions and 0 deletions

24
cloud-init-direxist.patch Normal file
View File

@ -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",

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Feb 4 16:44:12 UTC 2025 - Robert Schweikert <rjschwei@suse.com>
- 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 <daniel.garcia@suse.com>

View File

@ -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)