Blame SOURCES/0002-Replace-deprecated-LOG.warn-with-LOG.warning.patch

a64660
From 5d62b178c361953d983236ce86e7b6a61e961549 Mon Sep 17 00:00:00 2001
a64660
From: "Swapnil Kulkarni (coolsvap)" <me@coolsvap.net>
a64660
Date: Fri, 11 Mar 2016 13:09:24 +0530
a64660
Subject: [PATCH 02/21] Replace deprecated LOG.warn with LOG.warning
a64660
a64660
LOG.warn is deprecated. It still used in a few places.
a64660
Updated to non-deprecated LOG.warning.
a64660
a64660
Change-Id: I6e8df0e072448fbd4077c4e5d98b2986e9855489
a64660
Closes-Bug:#1508442
a64660
---
a64660
 bin/cfn-push-stats                   |  4 +--
a64660
 heat_cfntools/cfntools/cfn_helper.py | 40 +++++++++++++++-------------
a64660
 2 files changed, 24 insertions(+), 20 deletions(-)
a64660
a64660
diff --git a/bin/cfn-push-stats b/bin/cfn-push-stats
a64660
index 501a366..d1171ee 100755
a64660
--- a/bin/cfn-push-stats
a64660
+++ b/bin/cfn-push-stats
a64660
@@ -35,8 +35,8 @@ LOG = logging.getLogger('cfntools')
a64660
 try:
a64660
     import psutil
a64660
 except ImportError:
a64660
-    LOG.warn("psutil not available. If you want process and memory "
a64660
-             "statistics, you need to install it.")
a64660
+    LOG.warning("psutil not available. If you want process and memory "
a64660
+                "statistics, you need to install it.")
a64660
 
a64660
 from heat_cfntools.cfntools import cfn_helper
a64660
 
a64660
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py
a64660
index c340bda..19424b0 100644
a64660
--- a/heat_cfntools/cfntools/cfn_helper.py
a64660
+++ b/heat_cfntools/cfntools/cfn_helper.py
a64660
@@ -401,7 +401,7 @@ class RpmHelper(object):
a64660
         LOG.info("Installing packages: %s" % cmd)
a64660
         command = CommandRunner(cmd).run()
a64660
         if command.status:
a64660
-            LOG.warn("Failed to install packages: %s" % cmd)
a64660
+            LOG.warning("Failed to install packages: %s" % cmd)
a64660
 
a64660
     @classmethod
a64660
     def downgrade(cls, packages, rpms=True, zypper=False, dnf=False):
a64660
@@ -429,21 +429,21 @@ class RpmHelper(object):
a64660
             LOG.info("Downgrading packages: %s", cmd)
a64660
             command = CommandRunner(cmd).run()
a64660
             if command.status:
a64660
-                LOG.warn("Failed to downgrade packages: %s" % cmd)
a64660
+                LOG.warning("Failed to downgrade packages: %s" % cmd)
a64660
         elif dnf:
a64660
             cmd = ['dnf', '-y', 'downgrade']
a64660
             cmd.extend(packages)
a64660
             LOG.info("Downgrading packages: %s", cmd)
a64660
             command = CommandRunner(cmd).run()
a64660
             if command.status:
a64660
-                LOG.warn("Failed to downgrade packages: %s" % cmd)
a64660
+                LOG.warning("Failed to downgrade packages: %s" % cmd)
a64660
         else:
a64660
             cmd = ['yum', '-y', 'downgrade']
a64660
             cmd.extend(packages)
a64660
             LOG.info("Downgrading packages: %s" % cmd)
a64660
             command = CommandRunner(cmd).run()
a64660
             if command.status:
a64660
-                LOG.warn("Failed to downgrade packages: %s" % cmd)
a64660
+                LOG.warning("Failed to downgrade packages: %s" % cmd)
a64660
 
a64660
 
a64660
 class PackagesHandler(object):
a64660
@@ -521,7 +521,8 @@ class PackagesHandler(object):
a64660
                 # FIXME:print non-error, but skipping pkg
a64660
                 pass
a64660
             elif not RpmHelper.zypper_package_available(pkg):
a64660
-                LOG.warn("Skipping package '%s' - unavailable via zypper", pkg)
a64660
+                LOG.warning(
a64660
+                    "Skipping package '%s' - unavailable via zypper", pkg)
a64660
             elif not ver:
a64660
                 installs.append(pkg)
a64660
             else:
a64660
@@ -566,7 +567,8 @@ class PackagesHandler(object):
a64660
                 # FIXME:print non-error, but skipping pkg
a64660
                 pass
a64660
             elif not RpmHelper.dnf_package_available(pkg):
a64660
-                LOG.warn("Skipping package '%s'. Not available via yum" % pkg)
a64660
+                LOG.warning(
a64660
+                    "Skipping package '%s'. Not available via yum" % pkg)
a64660
             elif not ver:
a64660
                 installs.append(pkg)
a64660
             else:
a64660
@@ -622,7 +624,8 @@ class PackagesHandler(object):
a64660
                 # FIXME:print non-error, but skipping pkg
a64660
                 pass
a64660
             elif not RpmHelper.yum_package_available(pkg):
a64660
-                LOG.warn("Skipping package '%s'. Not available via yum" % pkg)
a64660
+                LOG.warning(
a64660
+                    "Skipping package '%s'. Not available via yum" % pkg)
a64660
             elif not ver:
a64660
                 installs.append(pkg)
a64660
             else:
a64660
@@ -702,7 +705,7 @@ class PackagesHandler(object):
a64660
         for manager, package_entries in packages:
a64660
             handler = self._package_handler(manager)
a64660
             if not handler:
a64660
-                LOG.warn("Skipping invalid package type: %s" % manager)
a64660
+                LOG.warning("Skipping invalid package type: %s" % manager)
a64660
             else:
a64660
                 handler(self, package_entries)
a64660
 
a64660
@@ -934,7 +937,7 @@ class ServicesHandler(object):
a64660
             command = handler(self, service, "status")
a64660
             running = command.status == 0
a64660
             if ensure_running and not running:
a64660
-                LOG.warn("Restarting service %s" % service)
a64660
+                LOG.warning("Restarting service %s" % service)
a64660
                 start_cmd = handler(self, service, "start")
a64660
                 if start_cmd.status != 0:
a64660
                     LOG.warning('Service %s did not start. STDERR: %s' %
a64660
@@ -969,7 +972,7 @@ class ServicesHandler(object):
a64660
         for manager, service_entries in self._services.items():
a64660
             handler = self._service_handler(manager)
a64660
             if not handler:
a64660
-                LOG.warn("Skipping invalid service type: %s" % manager)
a64660
+                LOG.warning("Skipping invalid service type: %s" % manager)
a64660
             else:
a64660
                 self._initialize_services(handler, service_entries)
a64660
 
a64660
@@ -980,7 +983,7 @@ class ServicesHandler(object):
a64660
         for manager, service_entries in self._services.items():
a64660
             handler = self._service_handler(manager)
a64660
             if not handler:
a64660
-                LOG.warn("Skipping invalid service type: %s" % manager)
a64660
+                LOG.warning("Skipping invalid service type: %s" % manager)
a64660
             else:
a64660
                 self._monitor_services(handler, service_entries)
a64660
 
a64660
@@ -1343,7 +1346,8 @@ class Metadata(object):
a64660
             try:
a64660
                 self._data = self.remote_metadata()
a64660
             except MetadataServerConnectionError as ex:
a64660
-                LOG.warn("Unable to retrieve remote metadata : %s" % str(ex))
a64660
+                LOG.warning(
a64660
+                    "Unable to retrieve remote metadata : %s" % str(ex))
a64660
 
a64660
                 # If reading remote metadata fails, we fall-back on local files
a64660
                 # in order to get the most up-to-date version, we try:
a64660
@@ -1360,8 +1364,8 @@ class Metadata(object):
a64660
                     try:
a64660
                         fd = open(filepath)
a64660
                     except IOError:
a64660
-                        LOG.warn("Unable to open local metadata : %s" %
a64660
-                                 filepath)
a64660
+                        LOG.warning("Unable to open local metadata : %s" %
a64660
+                                    filepath)
a64660
                         continue
a64660
                     else:
a64660
                         LOG.info("Opened local metadata %s" % filepath)
a64660
@@ -1389,8 +1393,8 @@ class Metadata(object):
a64660
                         pass
a64660
                     lm.close()
a64660
             except IOError:
a64660
-                LOG.warn("Unable to open local metadata : %s" %
a64660
-                         metadata_file)
a64660
+                LOG.warning("Unable to open local metadata : %s" %
a64660
+                            metadata_file)
a64660
                 continue
a64660
 
a64660
         if self._metadata != last_data:
a64660
@@ -1402,8 +1406,8 @@ class Metadata(object):
a64660
             try:
a64660
                 os.makedirs(cache_dir, mode=0o700)
a64660
             except IOError as e:
a64660
-                LOG.warn('could not create metadata cache dir %s [%s]' %
a64660
-                         (cache_dir, e))
a64660
+                LOG.warning('could not create metadata cache dir %s [%s]' %
a64660
+                            (cache_dir, e))
a64660
                 return
a64660
         # save current metadata to file
a64660
         tmp_dir = os.path.dirname(last_path)
a64660
-- 
a64660
2.20.1
a64660