Skip to content

Commit

Permalink
Add persistent_path option #56
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Sep 17, 2020
1 parent 6e77579 commit 1880543
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions config/figshare.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ csv_url = %(csv_url_prefix)s/%(csv_version)s/%(csv_filename)s
quota_list = [104857600, 536870912, 2147483648]
quota_class = ['ugrad', 'grad', 'faculty']

# Persistent storage path for logs
persistent_path = ***override***

# Log file
log_dir: logs
logfile_prefix: figshare_patrons
Expand Down
10 changes: 7 additions & 3 deletions scripts/script_run
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/user/bin/env python

from os import path
from os import path, chmod
from os import mkdir

import pandas as pd
Expand Down Expand Up @@ -34,6 +34,7 @@ if __name__ == '__main__':
# Parse command-line arguments
parser = argparse.ArgumentParser(description='Command-line driver for figshare patron management.')
parser.add_argument('--config', required=True, help='path to configuration file')
parser.add_argument('--persistent_path', required=True, help='full parent path for logs')
parser.add_argument('--ldap_host', help='LDAP host')
parser.add_argument('--ldap_base_dn', help='base DN for LDAP bind and query')
parser.add_argument('--ldap_user', help='user name for LDAP login')
Expand Down Expand Up @@ -78,7 +79,8 @@ if __name__ == '__main__':
config.read(args.config)

# Define logfile
log_dir = config.get('global', 'log_dir')
log_dir = path.join(args.persistent_path, config.get('global', 'log_dir'))

if not path.exists(log_dir):
mkdir(log_dir)
logfile_prefix = config.get('global', 'logfile_prefix')
Expand All @@ -93,7 +95,7 @@ if __name__ == '__main__':

cred_err = 0
vargs = vars(args)
for p in ['ldap_host', 'ldap_base_dn', 'ldap_user', 'ldap_password',
for p in ['persistent_path', 'ldap_host', 'ldap_base_dn', 'ldap_user', 'ldap_password',
'grouper_host', 'grouper_base_path', 'grouper_user', 'grouper_password',
'batch_size', 'batch_timeout', 'batch_delay', 'portal', 'quota',
'portal_file', 'quota_file', 'test', 'test_reverse', 'sync_max']:
Expand Down Expand Up @@ -302,3 +304,5 @@ if __name__ == '__main__':

log.info("******************************")
log.info("Exit 0")

chmod(path.join(log_dir, logfile), mode=0o666)
10 changes: 7 additions & 3 deletions scripts/user_update
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/user/bin/env python

from os import path
from os import path, chmod
from os import mkdir

from datetime import date
Expand Down Expand Up @@ -30,6 +30,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Command-line driver for simple user EDS updates.')
parser.add_argument('--netid', required=True, help='NetID for user')
parser.add_argument('--config', required=True, help='path to configuration file')
parser.add_argument('--persistent_path', required=True, help='full parent path for logs')
parser.add_argument('--ldap_host', help='LDAP host')
parser.add_argument('--ldap_base_dn', help='base DN for LDAP bind and query')
parser.add_argument('--ldap_user', help='user name for LDAP login')
Expand Down Expand Up @@ -70,7 +71,8 @@ if __name__ == '__main__':
config.read(args.config)

# Define logfile
log_dir = config.get('global', 'log_dir')
log_dir = path.join(args.persistent_path, config.get('global', 'log_dir'))

if not path.exists(log_dir):
mkdir(log_dir)
logfile = f"user_update.{today.strftime('%Y-%m-%d')}.log"
Expand All @@ -84,7 +86,7 @@ if __name__ == '__main__':

cred_err = 0
vargs = vars(args)
for p in ['netid', 'ldap_host', 'ldap_base_dn', 'ldap_user', 'ldap_password',
for p in ['netid', 'persistent_path', 'ldap_host', 'ldap_base_dn', 'ldap_user', 'ldap_password',
'grouper_host', 'grouper_base_path', 'grouper_user', 'grouper_password',
'batch_size', 'batch_timeout', 'batch_delay', 'portal', 'quota',
'portal_file', 'quota_file', 'sync_max', 'active_remove']:
Expand Down Expand Up @@ -289,3 +291,5 @@ if __name__ == '__main__':

log.info("*******************************")
log.info("Exit 0")

chmod(path.join(log_dir, logfile), mode=0o666)

0 comments on commit 1880543

Please sign in to comment.