-
Notifications
You must be signed in to change notification settings - Fork 0
Updated occweb authorization #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import unittest | ||
| import time | ||
| import Chandra.Time | ||
| import Ska.ftp | ||
|
|
||
| #--- reading directory list | ||
| # | ||
|
|
@@ -361,13 +362,16 @@ def download_glimmon(): | |
| cmd = 'mv -f ' + glimmon + ' ' + glimmon + '~' | ||
| os.system(cmd) | ||
|
|
||
| with open('/home/isobe/.occpass' , 'r') as f: | ||
| out = f.read().strip() | ||
| netrc = Ska.ftp.parse_netrc() | ||
| if 'occweb' not in netrc: | ||
| raise RuntimeError('must have occweb auth in ~/.netrc') | ||
|
|
||
| user = netrc['occweb']['login'] | ||
| password = netrc['occweb']['password'] | ||
| # | ||
| #--- download the database | ||
| # | ||
| cmd = 'curl -u tisobe:' + out | ||
| cmd = cmd + ' https://occweb.cfa.harvard.edu/occweb/FOT/engineering/thermal/' | ||
| cmd = f'curl -u {user}:{password} https://occweb.cfa.harvard.edu/occweb/FOT/engineering/thermal/' | ||
| cmd = cmd + 'AXAFAUTO_RSYNC/G_LIMMON_Archive/glimmondb.sqlite3 > ' + glimmon | ||
|
|
||
| os.system(cmd) | ||
|
|
@@ -401,20 +405,20 @@ def test_and_save(): | |
| #--- update the main mta limit database | ||
| # | ||
| if len(data) < 1: | ||
| cmd = 'rm ' + temp_opfile | ||
| cmd = f'rm {temp_opfile}' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge deal, but all these The main problem here is that there is no real error handling in the current |
||
| os.system(cmd) | ||
| else: | ||
| cmd = 'mv ' + temp_opfile + ' ' + main_dir +'op_limits.db' | ||
| cmd = f'mv {temp_opfile} {main_dir}/op_limits.db' | ||
| os.system(cmd) | ||
|
|
||
| tail = time.strftime("%m%d%y", time.gmtime()) | ||
| cmd = 'cp ' + main_dir + 'op_limits.db ' + main_dir + 'Past_data/op_limits.db_' + tail | ||
| cmd = f'cp {main_dir}/op_limits.db {main_dir}/Past_data/op_limits.db_{tail}' | ||
| os.system(cmd) | ||
|
|
||
| cmd = 'cp -f ' + main_dir + glimmon + '/data/mta4/MTA/data/op_limits/.' | ||
| cmd = f'cp -f {glimmon} /data/mta4/MTA/data/op_limits/.' | ||
| os.system(cmd) | ||
|
|
||
| cmd = 'cp ' + main_dir + glimmon + ' ' + main_dir + 'Past_data/' + glimmon + '_' + tail | ||
| cmd = f'cp {glimmon} {main_dir}/Past_data/glimmondb.sqlite3_{tail}' | ||
| os.system(cmd) | ||
| # | ||
| #--- notify the changes to admin person | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not secure since it exposes the password in your processes while curl is running. Use kadi.occweb.get_occweb_page instead with
binary=True.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like Tom had a low impact change. Do you want ot use that, or would you like to gow with this for now and change it later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented the change suggested by Tom, see below.