Skip to content

Commit

Permalink
Handle the chmod errors when trying to change all the Scoring files g…
Browse files Browse the repository at this point in the history
…roup write access
  • Loading branch information
ens-lgil committed Aug 24, 2023
1 parent 1a2b8a0 commit 9f9efd4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions release/scripts/CopyScoringFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def copy_scoring_files_to_production(self):

# Copy the file, if it was found new or modified
if copy_msg != '':
# Copy file
try:
shutil.copy2(scoring_file_ftp_priv, scoring_file_prod)
print(copy_msg)
Expand All @@ -138,13 +139,15 @@ def copy_scoring_files_to_production(self):
except IOError as e:
print(f'>>>>> ERROR! File \'{scoring_file}\' couldn\'t be copied to "{self.scoring_files_dir}"!')
print(e)
# Change chmod to allow group write access
if os.path.isfile(scoring_file_prod):
try:
os.chmod(scoring_file_prod, stat.S_IRUSR|stat.S_IWUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IROTH)
except:
print(f">>>>> ERROR! Can't change the read/write access of the file '{scoring_file}'!")
total_count = count_new_pgs + count_updated_pgs
print(f'Number of PGS files successfully copied: {total_count} (New: {count_new_pgs} | Updated: {count_updated_pgs} | Skipped: {count_skipped_pgs})')

# Change chmod to allow group write access
for fname in glob.glob(f'{self.scoring_files_dir}/*'):
os.chmod(fname, stat.S_IRUSR|stat.S_IWUSR|stat.S_IRGRP|stat.S_IWGRP|stat.S_IROTH)


def copy_scoring_files_to_metadata(self):
""" Copy the new/updated scoring files to the metadata directory (temporary FTP) """
Expand Down

0 comments on commit 9f9efd4

Please sign in to comment.