]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool domain backup: fix py2.6 incompatible format
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 20 Sep 2018 23:26:35 +0000 (11:26 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 26 Sep 2018 08:40:49 +0000 (10:40 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Sep 26 10:40:49 CEST 2018 on sn-devel-144

python/samba/netcmd/domain_backup.py

index ee6d2848decdbac0b9515c76ea04f7919b3e3427..5ddc1c18df6d184e0de9075b6254d96a2ff44521 100644 (file)
@@ -105,7 +105,7 @@ def get_timestamp():
 
 
 def backup_filepath(targetdir, name, time_str):
-    filename = 'samba-backup-{}-{}.tar.bz2'.format(name, time_str)
+    filename = 'samba-backup-%s-%s.tar.bz2' % (name, time_str)
     return os.path.join(targetdir, filename)
 
 
@@ -164,9 +164,9 @@ def set_admin_password(logger, samdb):
 
     # match the admin user by RID
     domainsid = samdb.get_domain_sid()
-    match_admin = "(objectsid={}-{})".format(domainsid,
-                                             security.DOMAIN_RID_ADMINISTRATOR)
-    search_expr = "(&(objectClass=user){})".format(match_admin)
+    match_admin = "(objectsid=%s-%s)" % (domainsid,
+                                         security.DOMAIN_RID_ADMINISTRATOR)
+    search_expr = "(&(objectClass=user)%s)" % (match_admin,)
 
     # retrieve the admin username (just in case it's been renamed)
     res = samdb.search(base=samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE,
@@ -850,7 +850,7 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
                 raise e
             raise copy_err
         if not os.path.exists(backup_path):
-            s = "tdbbackup said backup succeeded but {} not found"
+            s = "tdbbackup said backup succeeded but {0} not found"
             raise CommandError(s.format(backup_path))
 
     def offline_mdb_copy(self, path):
@@ -941,7 +941,7 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
 
         backup_dirs = [paths.private_dir, paths.state_dir,
                        os.path.dirname(paths.smbconf)]  # etc dir
-        logger.info('running backup on dirs: {}'.format(' '.join(backup_dirs)))
+        logger.info('running backup on dirs: {0}'.format(' '.join(backup_dirs)))
 
         # Recursively get all file paths in the backup directories
         all_files = []
@@ -1026,8 +1026,9 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
                 tar.add(path, arcname=arc_path)
 
         tar.close()
-        os.rename(temp_tar_name, os.path.join(targetdir,
-                  'samba-backup-{}.tar.bz2'.format(time_str)))
+        os.rename(temp_tar_name,
+                  os.path.join(targetdir,
+                               'samba-backup-{0}.tar.bz2'.format(time_str)))
         os.rmdir(temp_tar_dir)
         logger.info('Backup succeeded.')