forked from pool/cloud-init
- Add cloud-init-transact-up.patch to support transactional-updates
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=201
This commit is contained in:
parent
bdfec3b52b
commit
7cb54c8cc6
65
cloud-init-transact-up.patch
Normal file
65
cloud-init-transact-up.patch
Normal file
@ -0,0 +1,65 @@
|
||||
--- cloudinit/distros/opensuse.py.orig
|
||||
+++ cloudinit/distros/opensuse.py
|
||||
@@ -9,6 +9,7 @@
|
||||
# This file is part of cloud-init. See LICENSE file for license information.
|
||||
|
||||
import logging
|
||||
+import os
|
||||
|
||||
from cloudinit import distros, helpers, subp, util
|
||||
from cloudinit.distros import rhel_util as rhutil
|
||||
@@ -49,6 +50,7 @@ class Distro(distros.Distro):
|
||||
distros.Distro.__init__(self, name, cfg, paths)
|
||||
self._runner = helpers.Runners(paths)
|
||||
self.osfamily = "suse"
|
||||
+ self.update_method = None
|
||||
cfg["ssh_svcname"] = "sshd"
|
||||
if self.uses_systemd():
|
||||
self.init_cmd = ["systemctl"]
|
||||
@@ -74,12 +76,45 @@ class Distro(distros.Distro):
|
||||
if pkgs is None:
|
||||
pkgs = []
|
||||
|
||||
+ if self.update_method == None:
|
||||
+ result = util.get_mount_info("/")
|
||||
+ fs_type = ""
|
||||
+ if result:
|
||||
+ (devpth, fs_type, mount_point) = result
|
||||
+ if (
|
||||
+ fs_type.lower() == 'btrfs' and
|
||||
+ os.path.exists("/usr/sbin/transactional-update")
|
||||
+ ):
|
||||
+ self.update_method = 'transactional'
|
||||
+ else:
|
||||
+ self.update_method = 'zypper'
|
||||
+ else:
|
||||
+ LOG.info(
|
||||
+ "Could not determine filesystem type of '/' using zypper"
|
||||
+ )
|
||||
+ self.update_method = 'zypper'
|
||||
+
|
||||
# No user interaction possible, enable non-interactive mode
|
||||
- cmd = ["zypper", "--non-interactive"]
|
||||
+ if self.update_method == 'zypper':
|
||||
+ cmd = ["zypper", "--non-interactive"]
|
||||
+ else:
|
||||
+ cmd = [
|
||||
+ "transactional-update",
|
||||
+ "--non-interactive",
|
||||
+ "--drop-if-no-change",
|
||||
+ "pkg"
|
||||
+ ]
|
||||
|
||||
# Command is the operation, such as install
|
||||
if command == "upgrade":
|
||||
command = "update"
|
||||
+ if self.update_method == 'transactional' and not pkgs:
|
||||
+ command = "up"
|
||||
+ cmd = [
|
||||
+ "transactional-update",
|
||||
+ "--non-interactive",
|
||||
+ "--drop-if-no-change"
|
||||
+ ]
|
||||
cmd.append(command)
|
||||
|
||||
# args are the arguments to the command, not global options
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 3 22:02:32 UTC 2023 - Robert Schweikert <rjschwei@suse.com>
|
||||
|
||||
- Add cloud-init-transact-up.patch to support transactional-updates
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 31 19:47:23 UTC 2023 - Robert Schweikert <rjschwei@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package cloud-init
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2023 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -43,6 +43,8 @@ Patch7: cloud-init-micro-is-suse.patch
|
||||
Patch8: cloud-init-suse-afternm.patch
|
||||
# FIXME: https://github.com/canonical/cloud-init/pull/1435
|
||||
Patch9: cloud-init-prefer-nm.patch
|
||||
# FIXME:
|
||||
Patch10: cloud-init-transact-up.patch
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: filesystem
|
||||
# pkg-config is needed to find correct systemd unit dir
|
||||
@ -152,6 +154,7 @@ Documentation and examples for cloud-init tools
|
||||
%patch7
|
||||
%patch8
|
||||
%patch9
|
||||
%patch10
|
||||
|
||||
|
||||
# patch in the full version to version.py
|
||||
|
Loading…
Reference in New Issue
Block a user