From 158d2b1f5cc7ab295a93c9d59214d1a9a5c65ef2 Mon Sep 17 00:00:00 2001 From: Ning Yu Date: Mon, 18 May 2020 11:47:58 +0800 Subject: [PATCH] Revert "Updates according to PR comments" This reverts commit 43b9560714a8ac1a1b5925ddf2616a4a302e870b. --- gpMgmt/bin/gpexpand | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/gpMgmt/bin/gpexpand b/gpMgmt/bin/gpexpand index d07c3e61ab..7fcc28cdeb 100755 --- a/gpMgmt/bin/gpexpand +++ b/gpMgmt/bin/gpexpand @@ -829,8 +829,8 @@ SELECT pg_catalog.pg_relation_filepath(c.oid) continue # a pathname is like './pg_tblspc/16385/GPDB_7_301911081/16386/6052_vm' # we need to change it to './16385//GPDB_7_301911081/16386/6052_vm' - seps = pathname.split(os.sep) - pathname = os.sep.join([seps[2], str(dummyDBID)] + seps[3:]) + pathname = os.sep.join([pathname.split(os.sep)[2], str(dummyDBID)] + + pathname.split(os.sep)[3:]) full_excludes.append(os.path.join(tablespace_template_dir, pathname)) @@ -855,12 +855,7 @@ SELECT pg_catalog.pg_relation_filepath(c.oid) # so it is safe to use a check-and-create style to create dirs. if not os.path.isdir(dirname): os.makedirs(dirname) - # the file should not already exist, however in case it does, which - # indicates an error in the excluding logic, raise an error. - if os.path.exists(fullname): - self.logger.error("Could not exclude file '%s' from the template: file exists" % fullname) - raise Exception('Invalid exclude list') - open(fullname, 'ab') + open(fullname, 'wb') with open(os.path.join(self.tempDir, "pg_tblspc", @@ -1026,13 +1021,7 @@ SELECT pg_catalog.pg_relation_filepath(c.oid) # so it is safe to use a check-and-create style to create dirs. if not os.path.isdir(dirname): os.makedirs(dirname) - # the file should not already exist, however in case it does, - # which indicates an error in the excluding logic, raise an - # error. - if os.path.exists(fullname): - self.logger.error("Could not exclude file '%s' from the template: file exists" % fullname) - raise Exception('Invalid exclude list') - open(fullname, 'ab') + open(fullname, 'wb') def _tar_template(self): """Tars up the template files""" -- GitLab