Sync from SUSE:ALP:Source:Standard:1.0 python-azure-agent revision 904ec033535a3389003db3ad41b69ed0

This commit is contained in:
Adrian Schröter 2024-02-21 14:22:07 +01:00
commit 01af9e93b5
10 changed files with 1696 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
WALinuxAgent-2.9.1.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

11
agent-micro-is-sles.patch Normal file
View File

@ -0,0 +1,11 @@
--- azurelinuxagent/common/osutil/factory.py.orig
+++ azurelinuxagent/common/osutil/factory.py
@@ -90,7 +90,7 @@ def _get_osutil(distro_name, distro_code
if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"):
return CoreOSUtil()
- if distro_name in ("suse", "sle_hpc", "sles", "opensuse"):
+ if distro_name in ("suse", "sle-micro", "sle_hpc", "sles", "opensuse"):
if distro_full_name == 'SUSE Linux Enterprise Server' \
and Version(distro_version) < Version('12') \
or distro_full_name == 'openSUSE' and Version(distro_version) < Version('13.2'):

View File

@ -0,0 +1,11 @@
--- config/suse/waagent.conf.orig
+++ config/suse/waagent.conf
@@ -109,7 +109,7 @@ OS.SshDir=/etc/ssh
# OS.CheckRdmaDriver=y
# Enable or disable goal state processing auto-update, default is enabled
-# AutoUpdate.Enabled=y
+AutoUpdate.Enabled=n
# Determine the update family, this should not be changed
# AutoUpdate.GAFamily=Prod

View File

@ -0,0 +1,21 @@
--- azurelinuxagent/pa/rdma/suse.py.orig
+++ azurelinuxagent/pa/rdma/suse.py
@@ -31,8 +31,17 @@ class SUSERDMAHandler(RDMAHandler):
def install_driver(self): # pylint: disable=R1710
"""Install the appropriate driver package for the RDMA firmware"""
+ suport_pci_passthrough = False
+ if Version(DISTRO_VERSION) == Version('12'):
+ release_data = open('/etc/os-release').read()
+ if 'SP5' in release_data:
+ suport_pci_passthrough = True
+
if Version(DISTRO_VERSION) >= Version('15'):
- msg = 'SLE 15 and later only supports PCI pass through, no '
+ suport_pci_passthrough = True
+
+ if suport_pci_passthrough:
+ msg = 'SLE 12 SP5 and later only supports PCI pass through, no '
msg += 'special driver needed for IB interface'
logger.info(msg)
return True

19
paa_force_py3_sle15.patch Normal file
View File

@ -0,0 +1,19 @@
--- bin/waagent.orig
+++ bin/waagent
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Azure Linux Agent
#
--- init/waagent.service.orig
+++ init/waagent.service
@@ -8,7 +8,7 @@ ConditionPathExists=/etc/waagent.conf
[Service]
Type=simple
-ExecStart=/usr/bin/python -u /usr/sbin/waagent -daemon
+ExecStart=/usr/bin/python3 -u /usr/sbin/waagent -daemon
Restart=always
RestartSec=5

1060
python-azure-agent.changes Normal file

File diff suppressed because it is too large Load Diff

332
python-azure-agent.spec Normal file
View File

@ -0,0 +1,332 @@
#
# spec file for package python-azure-agent
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: python-azure-agent
Summary: Microsoft Azure Linux Agent
License: Apache-2.0
Group: System/Daemons
Version: 2.9.1.1
Release: 0
URL: https://github.com/Azure/WALinuxAgent
Source0: WALinuxAgent-%{version}.tar.gz
Patch1: agent-no-auto-update.patch
Patch6: paa_force_py3_sle15.patch
Patch7: reset-dhcp-deprovision.patch
Patch8: paa_12_sp5_rdma_no_ext_driver.patch
# PATCH-FIX-UPSTREAM gh#Azure/WALinuxAgent#2741
Patch9: remove-mock.patch
Patch10: agent-micro-is-sles.patch
BuildRequires: dos2unix
BuildRequires: distribution-release
BuildRequires: openssl
BuildRequires: python-rpm-macros
%if 0%{?suse_version} && 0%{?suse_version} > 1315
BuildRequires: python3-distro
BuildRequires: python3-setuptools
%else
BuildRequires: python-setuptools
BuildRequires: python-xml
%endif
BuildRequires: pkgconfig(udev)
Requires: eject
Requires: grep
Requires: iptables
Requires: logrotate
Requires: openssh
Requires: openssl
Requires: pwdutils
Requires: systemd
Requires: sysvinit-tools
%if 0%{?suse_version} && 0%{?suse_version} <= 1500
Requires: wicked
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1315
Requires: python3-distro
Requires: python3-pyasn1
Requires: python3-xml
%else
Requires: python-pyasn1
Requires: python-xml
%endif
Requires: sudo
Requires: util-linux
# Package renamed in SLE 12, do not remove Provides, Obsolete directives
# until after SLE 12 EOL
Provides: WALinuxAgent = %{version}
Obsoletes: WALinuxAgent < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
The azure-agent supports the provisioning and running of Linux
VMs in the Microsoft Azure Public Cloud and Microsoft Azure Stack private
cloud. This package should be installed on Linux disk
images that are built to run withing the Microsoft Azure or
Microsoft Azure Stack framework.
%package test
Summary: Unit tests
Group: Development/Languages/Python
Requires: %{name} == %{version}
Requires: openssl
%if 0%{?suse_version} > 1315
Requires: python3-pytest
%else
Requires: python-mock
Requires: python-pytest
%endif
%description test
Unit tests for python-azure-agent.
%package config-default
Summary: Default upstream configuration
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
%description config-default
The default configuration for the agent as supplied by upstream for SUSE
%package config-server
Summary: SUSE specific configuration for server products
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
%description config-server
Modified waagent.conf file to meet SUSE policies and SUSE image build
setup
%package config-hpc
Summary: SUSE specific configuration for HPC
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
%description config-hpc
Modified waagent.conf file to meet SUSE policies and SUSE image build
setup
%package config-micro
Summary: SUSE specific configuration for Micro
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
%description config-micro
Modified waagent.conf file to meet SUSE policies and SUSE image build
setup
%prep
%setup -qn WALinuxAgent-%{version}
%patch -P 1
%if 0%{?suse_version} && 0%{?suse_version} > 1315 && 0%{?sle_version}
%patch -P 6
%endif
%patch -P 7
%patch -P 8
%patch -P 9 -p1
%patch -P 10
%build
%if 0%{?suse_version} && 0%{?suse_version} > 1315
python3 setup.py build
%else
python setup.py build
%endif
%install
%if 0%{?suse_version} && 0%{?suse_version} > 1315
python3 setup.py install --prefix=%{_prefix} --lnx-distro='suse' --root=%{buildroot}
%else
python setup.py install --prefix=%{_prefix} --lnx-distro='suse' --root=%{buildroot}
%endif
# Config file flavor setup
cp %{buildroot}%{_sysconfdir}/waagent.conf %{buildroot}%{_sysconfdir}/waagent.conf.default
# No autoupdate of binaries for any SUSE product
sed -i -e "s/# AutoUpdate.Enabled=y/AutoUpdate.Enabled=n/" %{buildroot}%{_sysconfdir}/waagent.conf
# Common settings for most SUSE products
# Generate all supported SSH host key types
sed -i -e "s/SshHostKeyPairType=rsa/SshHostKeyPairType=auto/" %{buildroot}%{_sysconfdir}/waagent.conf
# We use clod-init
sed -i -e "s/Provisioning.Agent=auto/Provisioning.Agent=cloud-init/" %{buildroot}%{_sysconfdir}/waagent.conf
# Leave the ephemeral disk handling to cloud-init
sed -i -e "s/ResourceDisk.Format=y/ResourceDisk.Format=n/" %{buildroot}%{_sysconfdir}/waagent.conf
cp %{buildroot}%{_sysconfdir}/waagent.conf %{buildroot}%{_sysconfdir}/waagent.conf.server
# HPC setup is addition to SUSE server configuration
# While there is no more specific driver we still need to enable
# RDMA to make the logic in the agent set up the IB interface
sed -i -e "s/# OS.EnableRDMA=y/OS.EnableRDMA=y/" %{buildroot}%{_sysconfdir}/waagent.conf
cp %{buildroot}%{_sysconfdir}/waagent.conf %{buildroot}%{_sysconfdir}/waagent.conf.hpc
# Micro setup
# Undo the HPC change
sed -i -e "s/OS.EnableRDMA=y/# OS.EnableRDMA=y/" %{buildroot}%{_sysconfdir}/waagent.conf
# Use Ignition/Afterburn in Micro
sed -i -e "s/Provisioning.Agent=cloud-init/Provisioning.Agent=disabled/" %{buildroot}%{_sysconfdir}/waagent.conf
# No extension support for transactional-upfdate systems
# There's an inherant bug in that root password reset is also treated via this
# switch
sed -i -e "s/Extensions.Enabled=y/Extensions.Enabled=n/" %{buildroot}%{_sysconfdir}/waagent.conf
mv %{buildroot}%{_sysconfdir}/waagent.conf %{buildroot}%{_sysconfdir}/waagent.conf.micro
ln -s service %{buildroot}%{_sbindir}/rcwaagent
mkdir -p %{buildroot}/%{_unitdir}
# Deal with logic embeded in the code that puts the unit file where we do not
# want it, sometimes (depending on teh build environment)
if [ -e %{buildroot}/lib/systemd/system ]; then
mv %{buildroot}/lib/systemd/system/* %{buildroot}/%{_unitdir}
fi
### udev rules
%if 0%{?suse_version} < 1230
mkdir -p %{buildroot}/lib/udev/rules.d
mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}/lib/udev/rules.d/
%else
mkdir -p %{buildroot}/usr/lib/udev/rules.d
mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}/usr/lib/udev/rules.d/
%endif
### log file ghost
mkdir -p %{buildroot}/%{_localstatedir}/log
touch %{buildroot}/%{_localstatedir}/log/waagent.log
### permissinon fixes
chmod +x %{buildroot}/%{_sbindir}/waagent2.0
### naming issues
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
mv %{buildroot}/%{_sysconfdir}/logrotate.d/waagent.logrotate %{buildroot}/%{_distconfdir}/logrotate.d/waagent
%else
mv %{buildroot}/%{_sysconfdir}/logrotate.d/waagent.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/waagent
%endif
# install tests
%if 0%{?suse_version} && 0%{?suse_version} > 1315
cp -r tests %{buildroot}/%{python3_sitelib}/azurelinuxagent
%else
cp -r tests %{buildroot}/%{python_sitelib}/azurelinuxagent
%endif
%pre
%service_add_pre waagent.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/waagent ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/waagent ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%post
%service_add_post waagent.service
%preun
%service_del_preun waagent.service
%postun
%restart_on_update waagent
%service_del_postun waagent.service
%post config-default
rm -rf %{_sysconfdir}/waagent.conf
ln -s %{_sysconfdir}/waagent.conf.default %{_sysconfdir}/waagent.conf
%post config-server
rm -rf %{_sysconfdir}/waagent.conf
ln -s %{_sysconfdir}/waagent.conf.server %{_sysconfdir}/waagent.conf
%post config-hpc
rm -rf %{_sysconfdir}/waagent.conf
ln -s %{_sysconfdir}/waagent.conf.hpc %{_sysconfdir}/waagent.conf
%post config-micro
rm -rf %{_sysconfdir}/waagent.conf
ln -s %{_sysconfdir}/waagent.conf.micro %{_sysconfdir}/waagent.conf
%files
%defattr(0644,root,root,0755)
%doc NOTICE README.md
%license LICENSE.txt
%exclude %{_sysconfdir}/waagent.conf*
%{_sbindir}/rcwaagent
%attr(0755,root,root) %{_sbindir}/waagent
%attr(0755,root,root) %{_sbindir}/waagent2.0
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/waagent
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/waagent
%endif
%ghost %{_localstatedir}/log/waagent.log
%{_unitdir}/waagent.service
%if 0%{?suse_version} < 1230
/lib/udev/rules.d/66-azure-storage.rules
/lib/udev/rules.d/99-azure-product-uuid.rules
%else
/usr/lib/udev/rules.d/66-azure-storage.rules
/usr/lib/udev/rules.d/99-azure-product-uuid.rules
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%dir %{python3_sitelib}/azurelinuxagent
%{python3_sitelib}
%exclude %{python3_sitelib}/azurelinuxagent/tests
%else
%dir %{python_sitelib}/azurelinuxagent
%{python_sitelib}
%exclude %{python_sitelib}/azurelinuxagent/tests
%endif
%files test
%defattr(0644,root,root,0755)
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%{python3_sitelib}/azurelinuxagent/tests
%else
%{python_sitelib}/azurelinuxagent/tests
%endif
%files config-default
%ghost %{_sysconfdir}/waagent.conf
%config(noreplace) %{_sysconfdir}/waagent.conf.default
%files config-server
%ghost %{_sysconfdir}/waagent.conf
%config(noreplace) %{_sysconfdir}/waagent.conf.server
%files config-hpc
%ghost %{_sysconfdir}/waagent.conf
%config(noreplace) %{_sysconfdir}/waagent.conf.hpc
%files config-micro
%ghost %{_sysconfdir}/waagent.conf
%config(noreplace) %{_sysconfdir}/waagent.conf.micro
%changelog

160
remove-mock.patch Normal file
View File

@ -0,0 +1,160 @@
Index: WALinuxAgent-2.9.1.1/tests/common/dhcp/test_dhcp.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/dhcp/test_dhcp.py
+++ WALinuxAgent-2.9.1.1/tests/common/dhcp/test_dhcp.py
@@ -15,7 +15,10 @@
# Requires Python 2.6+ and Openssl 1.0+
#
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import azurelinuxagent.common.dhcp as dhcp
import azurelinuxagent.common.osutil.default as osutil
from tests.tools import AgentTestCase, open_patch, patch
Index: WALinuxAgent-2.9.1.1/tests/common/osutil/test_default.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/osutil/test_default.py
+++ WALinuxAgent-2.9.1.1/tests/common/osutil/test_default.py
@@ -22,7 +22,10 @@ import subprocess
import tempfile
import unittest
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import azurelinuxagent.common.conf as conf
import azurelinuxagent.common.osutil.default as osutil
Index: WALinuxAgent-2.9.1.1/tests/common/test_event.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/test_event.py
+++ WALinuxAgent-2.9.1.1/tests/common/test_event.py
@@ -26,7 +26,10 @@ import threading
import xml.dom
from datetime import datetime, timedelta
-from mock import MagicMock
+try:
+ from unittest.mock import MagicMock
+except ImportError:
+ from mock import MagicMock
from azurelinuxagent.common.utils import textutil, fileutil
from azurelinuxagent.common import event, logger
Index: WALinuxAgent-2.9.1.1/tests/common/test_version.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/test_version.py
+++ WALinuxAgent-2.9.1.1/tests/common/test_version.py
@@ -20,7 +20,10 @@ from __future__ import print_function
import os
import textwrap
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import azurelinuxagent.common.conf as conf
from azurelinuxagent.common.future import ustr
Index: WALinuxAgent-2.9.1.1/tests/distro/test_scvmm.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/distro/test_scvmm.py
+++ WALinuxAgent-2.9.1.1/tests/distro/test_scvmm.py
@@ -20,7 +20,10 @@
import os
import unittest
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import azurelinuxagent.daemon.scvmm as scvmm
from azurelinuxagent.common import conf
Index: WALinuxAgent-2.9.1.1/tests/ga/mocks.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/mocks.py
+++ WALinuxAgent-2.9.1.1/tests/ga/mocks.py
@@ -17,7 +17,10 @@
import contextlib
-from mock import PropertyMock
+try:
+ from unittest.mock import PropertyMock
+except ImportError:
+ from mock import PropertyMock
from azurelinuxagent.ga.exthandlers import ExtHandlersHandler
from azurelinuxagent.ga.remoteaccess import RemoteAccessHandler
from azurelinuxagent.ga.update import UpdateHandler, get_update_handler
Index: WALinuxAgent-2.9.1.1/tests/ga/test_collect_telemetry_events.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_collect_telemetry_events.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_collect_telemetry_events.py
@@ -26,7 +26,10 @@ import string
import uuid
from collections import defaultdict
-from mock import patch, MagicMock
+try:
+ from unittest.mock import patch, MagicMock
+except ImportError:
+ from mock import patch, MagicMock
from azurelinuxagent.common import conf
from azurelinuxagent.common.event import EVENTS_DIRECTORY
Index: WALinuxAgent-2.9.1.1/tests/ga/test_remoteaccess_handler.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_remoteaccess_handler.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_remoteaccess_handler.py
@@ -16,7 +16,10 @@
#
from datetime import timedelta, datetime
-from mock import Mock, MagicMock
+try:
+ from unittest.mock import Mock, MagicMock
+except ImportError:
+ from mock import Mock, MagicMock
from azurelinuxagent.common.osutil.default import DefaultOSUtil
from azurelinuxagent.common.protocol.goal_state import RemoteAccess
from azurelinuxagent.common.protocol.util import ProtocolUtil
Index: WALinuxAgent-2.9.1.1/tests/ga/test_send_telemetry_events.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_send_telemetry_events.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_send_telemetry_events.py
@@ -24,7 +24,10 @@ import time
import uuid
from datetime import datetime, timedelta
-from mock import MagicMock, Mock, patch, PropertyMock
+try:
+ from unittest.mock import MagicMock, Mock, patch, PropertyMock
+except ImportError:
+ from mock import MagicMock, Mock, patch, PropertyMock
from azurelinuxagent.common import logger
from azurelinuxagent.common.datacontract import get_properties
Index: WALinuxAgent-2.9.1.1/tests/utils/test_network_util.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/utils/test_network_util.py
+++ WALinuxAgent-2.9.1.1/tests/utils/test_network_util.py
@@ -16,7 +16,10 @@
#
import subprocess
-from mock.mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
import azurelinuxagent.common.utils.networkutil as networkutil
from tests.tools import AgentTestCase

View File

@ -0,0 +1,56 @@
--- azurelinuxagent/pa/deprovision/factory.py.orig
+++ azurelinuxagent/pa/deprovision/factory.py
@@ -22,6 +22,7 @@ from .arch import ArchDeprovisionHandler
from .clearlinux import ClearLinuxDeprovisionHandler
from .coreos import CoreOSDeprovisionHandler
from .default import DeprovisionHandler
+from .suse import SUSEDeprovisionHandler
from .ubuntu import UbuntuDeprovisionHandler, Ubuntu1804DeprovisionHandler
@@ -39,6 +40,8 @@ def get_deprovision_handler(distro_name=
return CoreOSDeprovisionHandler()
if "Clear Linux" in distro_full_name:
return ClearLinuxDeprovisionHandler() # pylint: disable=E1120
+ if distro_name in ("suse", "sle_hpc", "sles", "opensuse"):
+ return SUSEDeprovisionHandler()
return DeprovisionHandler()
--- /dev/null
+++ azurelinuxagent/pa/deprovision/suse.py
@@ -0,0 +1,34 @@
+# Microsoft Azure Linux Agent
+#
+# Copyright 2022 Microsoft Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Requires Python 2.6+ and Openssl 1.0+
+#
+
+import azurelinuxagent.common.utils.fileutil as fileutil
+from azurelinuxagent.pa.deprovision.default import DeprovisionHandler, \
+ DeprovisionAction
+
+class SUSEDeprovisionHandler(DeprovisionHandler):
+ def __init__(self):
+ super(SUSEDeprovisionHandler, self).__init__()
+
+ def reset_hostname(self, warnings, actions):
+ localhost = ["AUTO"]
+ actions.append(DeprovisionAction(self.osutil.set_hostname,
+ localhost))
+ actions.append(DeprovisionAction(self.osutil.set_dhcp_hostname,
+ localhost))
+