Update is logging too much info into info log.

Patch attached.

--
Martin Basti

From 9af056e70bc8ea3a0aa50269e6e7fe7af174e68c Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Mon, 8 Jun 2015 17:33:11 +0200
Subject: [PATCH] Server Upgrade: use debug log level for upgrade instead of
 info

Upgrade contains too many unnecessary info logs.
---
 ipalib/plugins/permission.py                       |  2 +-
 ipaserver/install/ldapupdate.py                    | 30 +++++++++++-----------
 ipaserver/install/plugins/adtrust.py               |  4 +--
 ipaserver/install/plugins/dns.py                   |  8 +++---
 ipaserver/install/plugins/update_idranges.py       |  2 +-
 .../install/plugins/update_managed_permissions.py  | 22 ++++++++--------
 ipaserver/install/plugins/update_referint.py       |  2 +-
 ipaserver/install/schemaupdate.py                  | 10 ++++----
 8 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index f46affc34cfa6f49c2ca1b3947a39ca5ec2549b9..f2e896935cc777801ec3a70262372f296b1ea2b8 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -648,7 +648,7 @@ class permission(baseldap.LDAPObject):
         try:
             ldap.update_entry(acientry)
         except errors.EmptyModlist:
-            self.log.info('No changes to ACI')
+            self.log.debug('No changes to ACI')
         return acientry, acistring
 
     def _get_aci_entry_and_string(self, permission_entry, name=None,
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index f30659fe96ea57512ccf5c053d0bc4add348061d..7359dbc4e549c57fad2b7048611252c92f8eb66d 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -544,7 +544,7 @@ class LDAPUpdate:
             nsIndexAttribute=[attribute],
         )
 
-        self.info("Creating task to index attribute: %s", attribute)
+        self.debug("Creating task to index attribute: %s", attribute)
         self.debug("Task id: %s", dn)
 
         self.conn.add_entry(e)
@@ -580,7 +580,7 @@ class LDAPUpdate:
                 continue
 
             if status.lower().find("finished") > -1:
-                self.info("Indexing finished")
+                self.debug("Indexing finished")
                 break
 
             self.debug("Indexing in progress")
@@ -652,7 +652,7 @@ class LDAPUpdate:
                 try:
                     entry_values.remove(update_value)
                 except ValueError:
-                    self.warning("remove: '%s' not in %s", update_value, attr)
+                    self.debug("remove: '%s' not in %s", update_value, attr)
                 else:
                     entry[attr] = entry_values
                     self.debug('remove: updated value %s', safe_output(
@@ -746,15 +746,15 @@ class LDAPUpdate:
                 raise BadSyntax, "More than 1 entry returned on a dn search!? %s" % new_entry.dn
             entry = e[0]
             found = True
-            self.info("Updating existing entry: %s", entry.dn)
+            self.debug("Updating existing entry: %s", entry.dn)
         except errors.NotFound:
             # Doesn't exist, start with the default entry
             entry = new_entry
-            self.info("New entry: %s", entry.dn)
+            self.debug("New entry: %s", entry.dn)
         except errors.DatabaseError:
             # Doesn't exist, start with the default entry
             entry = new_entry
-            self.info("New entry, using default value: %s", entry.dn)
+            self.debug("New entry, using default value: %s", entry.dn)
 
         self.print_entity(entry, "Initial value")
 
@@ -779,8 +779,8 @@ class LDAPUpdate:
                     except errors.NotFound:
                         # parent entry of the added entry does not exist
                         # this may not be an error (e.g. entries in NIS container)
-                        self.info("Parent DN of %s may not exist, cannot create the entry",
-                                entry.dn)
+                        self.error("Parent DN of %s may not exist, cannot "
+                                   "create the entry", entry.dn)
                         return
                 added = True
                 self.modified = True
@@ -799,9 +799,9 @@ class LDAPUpdate:
                 self.debug("Updated %d" % updated)
                 if updated:
                     self.conn.update_entry(entry)
-                self.info("Done")
+                self.debug("Done")
             except errors.EmptyModlist:
-                self.info("Entry already up-to-date")
+                self.debug("Entry already up-to-date")
                 updated = False
             except errors.DatabaseError, e:
                 self.error("Update failed: %s", e)
@@ -827,11 +827,11 @@ class LDAPUpdate:
 
         dn = updates['dn']
         try:
-            self.info("Deleting entry %s", dn)
+            self.debug("Deleting entry %s", dn)
             self.conn.delete_entry(dn)
             self.modified = True
         except errors.NotFound, e:
-            self.info("%s did not exist:%s", dn, e)
+            self.debug("%s did not exist:%s", dn, e)
             self.modified = True
         except errors.DatabaseError, e:
             self.error("Delete failed: %s", e)
@@ -849,7 +849,7 @@ class LDAPUpdate:
         return f
 
     def _run_update_plugin(self, plugin_name):
-        self.log.info("Executing upgrade plugin: %s", plugin_name)
+        self.log.debug("Executing upgrade plugin: %s", plugin_name)
         restart_ds, updates = self.api.Updater[plugin_name]()
         if updates:
             self._run_updates(updates)
@@ -896,7 +896,7 @@ class LDAPUpdate:
 
             for f in upgrade_files:
                 try:
-                    self.info("Parsing update file '%s'" % f)
+                    self.debug("Parsing update file '%s'" % f)
                     data = self.read_file(f)
                 except Exception, e:
                     self.error("error reading update file '%s'", f)
@@ -932,6 +932,6 @@ class LDAPUpdate:
 
     def restart_ds(self):
         dirsrv = services.knownservices.dirsrv
-        self.log.info('Restarting directory server to apply updates')
+        self.log.debug('Restarting directory server to apply updates')
         dirsrv.restart()
         wait_for_open_socket(self.socket_name)
diff --git a/ipaserver/install/plugins/adtrust.py b/ipaserver/install/plugins/adtrust.py
index 941bb632900a74dfbd1de585dfc64b4f18d7eb70..d96bfe83e3b9d1d3e64b9fde385fbf520ed20a3a 100644
--- a/ipaserver/install/plugins/adtrust.py
+++ b/ipaserver/install/plugins/adtrust.py
@@ -139,7 +139,7 @@ class update_default_trust_view(Updater):
 
         # First, see if trusts are enabled on the server
         if not self.api.Command.adtrust_is_enabled()['result']:
-            self.log.info('AD Trusts are not enabled on this server')
+            self.log.debug('AD Trusts are not enabled on this server')
             return False, []
 
         # Second, make sure the Default Trust View does not exist yet
@@ -148,7 +148,7 @@ class update_default_trust_view(Updater):
         except errors.NotFound:
             pass
         else:
-            self.log.info('Default Trust View already present on this server')
+            self.log.debug('Default Trust View already present on this server')
             return False, []
 
         # We have a server with AD trust support without Default Trust View.
diff --git a/ipaserver/install/plugins/dns.py b/ipaserver/install/plugins/dns.py
index aafea4462e0c3d2684a40a465f43a7e378af52b6..3d40e0e3a310f85e488f49b01e4c75ce3ceee13d 100644
--- a/ipaserver/install/plugins/dns.py
+++ b/ipaserver/install/plugins/dns.py
@@ -64,7 +64,7 @@ class update_dnszones(Updater):
         try:
             zones = self.api.Command.dnszone_find(all=True)['result']
         except errors.NotFound:
-            self.log.info('No DNS zone to update found')
+            self.log.debug('No DNS zone to update found')
             return False, []
 
         for zone in zones:
@@ -173,7 +173,7 @@ class update_master_to_dnsforwardzones(Updater):
                 # no upgrade is required
                 return False, []
 
-        self.log.info('Updating forward zones')
+        self.log.debug('Updating forward zones')
         # update the DNSVersion, following upgrade can be executed only once
         container_entry.setdefault(
             'ipaConfigString', []).append(u"DNSVersion 1")
@@ -202,7 +202,7 @@ class update_master_to_dnsforwardzones(Updater):
             pass
 
         if not zones:
-            self.log.info('No DNS zone to update found')
+            self.log.debug('No DNS zone to update found')
             return False, []
 
         zones_to_transform = []
@@ -346,7 +346,7 @@ class update_master_to_dnsforwardzones(Updater):
                                               zone['idnsname'][0])
                                 continue
 
-                self.log.info('Zone %s was sucessfully transformed to forward zone',
+                self.log.debug('Zone %s was sucessfully transformed to forward zone',
                               zone['idnsname'][0])
 
         return False, []
diff --git a/ipaserver/install/plugins/update_idranges.py b/ipaserver/install/plugins/update_idranges.py
index 3181e9ec54f19859c5bcbcde9ea551476d1910f7..badde9453b18edf03943c4edab041f043eb882a2 100644
--- a/ipaserver/install/plugins/update_idranges.py
+++ b/ipaserver/install/plugins/update_idranges.py
@@ -152,7 +152,7 @@ class update_idrange_baserid(Updater):
         for entry in entries:
             entry['ipabaserid'] = 0
             try:
-                root_logger.info("Updating existing idrange: %s" % (entry.dn))
+                root_logger.debug("Updating existing idrange: %s" % (entry.dn))
                 ldap.update_entry(entry)
                 root_logger.info("Done")
             except (errors.EmptyModlist, errors.NotFound):
diff --git a/ipaserver/install/plugins/update_managed_permissions.py b/ipaserver/install/plugins/update_managed_permissions.py
index 11765fba33342eb0168cfffa2f354f5ffc8cf4ef..a3694ae968726bc6061d9f84fe155fae13049121 100644
--- a/ipaserver/install/plugins/update_managed_permissions.py
+++ b/ipaserver/install/plugins/update_managed_permissions.py
@@ -384,7 +384,7 @@ class update_managed_permissions(Updater):
 
         for acistr in acistrs:
             if ACI(acistr).isequal(anonymous_read_aci):
-                self.log.info('Removing anonymous ACI: %s', acistr)
+                self.log.debug('Removing anonymous ACI: %s', acistr)
                 acistrs.remove(acistr)
                 break
         else:
@@ -413,18 +413,18 @@ class update_managed_permissions(Updater):
         anonymous_read_aci = self.get_anonymous_read_aci(ldap)
 
         if anonymous_read_aci:
-            self.log.info('Anonymous read ACI: %s', anonymous_read_aci)
+            self.log.debug('Anonymous read ACI: %s', anonymous_read_aci)
         else:
-            self.log.info('Anonymous ACI not found')
+            self.log.debug('Anonymous ACI not found')
 
         current_obj = ()  # initially distinct from any obj value, even None
         for name, template, obj in self.get_templates():
             if current_obj != obj:
                 if obj:
-                    self.log.info('Updating managed permissions for %s',
+                    self.log.debug('Updating managed permissions for %s',
                                   obj.name)
                 else:
-                    self.log.info('Updating non-object managed permissions')
+                    self.log.debug('Updating non-object managed permissions')
                 current_obj = obj
 
             self.update_permission(ldap,
@@ -445,7 +445,7 @@ class update_managed_permissions(Updater):
             except errors.NotFound:
                 self.log.debug('Obsolete permission not found')
             else:
-                self.log.info('Obsolete permission deleted: %s', obsolete_name)
+                self.log.debug('Obsolete permission deleted: %s', obsolete_name)
 
         return False, ()
 
@@ -537,7 +537,7 @@ class update_managed_permissions(Updater):
             permission_plugin.update_aci(entry)
 
         if remove_legacy:
-            self.log.info("Removing legacy permission '%s'", legacy_name)
+            self.log.debug("Removing legacy permission '%s'", legacy_name)
             self.api.Command[permission_del](unicode(legacy_name))
 
         for name in template.get('replaces_system', ()):
@@ -546,14 +546,14 @@ class update_managed_permissions(Updater):
                 entry = ldap.get_entry(permission_plugin.get_dn(name),
                                        ['ipapermissiontype'])
             except errors.NotFound:
-                self.log.info("Legacy permission '%s' not found", name)
+                self.log.debug("Legacy permission '%s' not found", name)
             else:
                 flags = entry.get('ipapermissiontype', [])
                 if list(flags) == ['SYSTEM']:
-                    self.log.info("Removing legacy permission '%s'", name)
+                    self.log.debug("Removing legacy permission '%s'", name)
                     self.api.Command[permission_del](name, force=True)
                 else:
-                    self.log.info("Ignoring V2 permission '%s'", name)
+                    self.log.debug("Ignoring V2 permission '%s'", name)
 
     def get_upgrade_attr_lists(self, current_acistring, default_acistrings):
         """Compute included and excluded attributes for a new permission
@@ -716,7 +716,7 @@ class update_managed_permissions(Updater):
                 anonymous_read_aci.target['targetattr']['expression'])
             read_blacklist &= attributes
             if read_blacklist:
-                self.log.info('Excluded attributes for %s: %s',
+                self.log.debug('Excluded attributes for %s: %s',
                               name, ', '.join(read_blacklist))
                 entry['ipapermexcludedattr'] = list(read_blacklist)
 
diff --git a/ipaserver/install/plugins/update_referint.py b/ipaserver/install/plugins/update_referint.py
index 960a5ad1a8fe13d985671e69c6355ac35beee0f1..c5c80359ee9cee0946152f0fefd38d41f47df6b5 100644
--- a/ipaserver/install/plugins/update_referint.py
+++ b/ipaserver/install/plugins/update_referint.py
@@ -45,7 +45,7 @@ class update_referint(Updater):
             entry['referint-update-delay'] = update_delay
             entry['nsslapd-pluginArg0'] = None
         else:
-            root_logger.info("Plugin already uses new style, skipping")
+            root_logger.debug("Plugin already uses new style, skipping")
             return False, []
 
         # nsslapd-pluginArg1    -> referint-logfile
diff --git a/ipaserver/install/schemaupdate.py b/ipaserver/install/schemaupdate.py
index 9a882c9b610ccfe7c9b4d88724d40b1ebe52aca6..03edb63075e893ca9887559de6470b9f94c40cf9 100644
--- a/ipaserver/install/schemaupdate.py
+++ b/ipaserver/install/schemaupdate.py
@@ -124,7 +124,7 @@ def update_schema(schema_files, ldapi=False, dm_password=None,):
                           for attr in schema_entry[attrname]}
 
     for filename in schema_files:
-        log.info('Processing schema LDIF file %s', filename)
+        log.debug('Processing schema LDIF file %s', filename)
         dn, new_schema = ldap.schema.subentry.urlfetch(filename)
 
         for attrname, cls in SCHEMA_ELEMENT_CLASSES:
@@ -147,10 +147,10 @@ def update_schema(schema_files, ldapi=False, dm_password=None,):
 
                         if old_obj:
                             old_attr = old_entries_by_oid.get(oid)
-                            log.info('Replace: %s', old_attr)
-                            log.info('   with: %s', value)
+                            log.debug('Replace: %s', old_attr)
+                            log.debug('   with: %s', value)
                         else:
-                            log.info('Add: %s', value)
+                            log.debug('Add: %s', value)
 
                 modified = modified or new_elements
                 schema_entry[attrname].extend(new_elements)
@@ -163,7 +163,7 @@ def update_schema(schema_files, ldapi=False, dm_password=None,):
                     conn.update_entry(schema_entry)
 
     if not modified:
-        log.info('Not updating schema')
+        log.debug('Not updating schema')
 
     return modified
 
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to