Skip to content

Commit

Permalink
turn verify into env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Jul 11, 2024
1 parent 7f9823a commit e6feaff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions coldfront/config/plugins/fasrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
INSTALLED_APPS += [ 'coldfront.plugins.fasrc' ]

NEO4JP = ENV.str('NEO4JP')
ATT_VERIFY = ENV.str('ATT_VERIFY', default=True)

LOGGING['handlers']['fasrc'] = {
'class': 'logging.handlers.TimedRotatingFileHandler',
Expand Down
1 change: 1 addition & 0 deletions coldfront/config/plugins/xdmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

XDMOD_USER = ENV.str('XDMOD_USER', default='')
XDMOD_PASS = ENV.str('XDMOD_PASS', default='')
XDMOD_VERIFY = ENV.str('XDMOD_VERIFY', default=True)
XDMOD_API_URL = ENV.str('XDMOD_API_URL')


Expand Down
7 changes: 4 additions & 3 deletions coldfront/plugins/fasrc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

logger = logging.getLogger(__name__)

ATT_VERIFY = import_from_settings('ATT_VERIFY')

class ATTAllocationQuery:

Expand Down Expand Up @@ -73,8 +74,8 @@ def produce_query_statement(self, vol_type, volumes=None):
'fs_path': 'LogicalVolume',
'path_replace': '/dev/data/',
'usedgb': 'UsedGB',
'sizebytes': 'SizeGB * 1073741824',
'usedbytes': 'UsedGB * 1073741824',
'sizebytes': 'SizeGB * 1000000000',
'usedbytes': 'UsedGB * 1000000000',
'server_replace': '.rc.fas.harvard.edu',
'unique': 'datetime(e.DotsLVSUpdateDate) as update_date, \
datetime(e.DotsLVDisplayUpdateDate) as display_date'
Expand Down Expand Up @@ -170,7 +171,7 @@ def __init__(self, volumes=None):
self.volumes = volumes

def post_query(self, query):
resp = requests.post(self.url, headers=self.headers, data=json.dumps(query))
resp = requests.post(self.url, headers=self.headers, data=json.dumps(query), verify=ATT_VERIFY)
return json.loads(resp.text)

def format_query_results(self, resp_json):
Expand Down
4 changes: 3 additions & 1 deletion coldfront/plugins/xdmod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

XDMOD_API_URL = import_from_settings('XDMOD_API_URL')

XDMOD_VERIFY = import_from_settings('XDMOD_VERIFY')

_ENDPOINT_CORE_HOURS = '/controllers/user_interface.php'

_DEFAULT_PARAMS = {
Expand Down Expand Up @@ -71,7 +73,7 @@ def __init__(self, start=QUARTER_START, end=QUARTER_END, resources=None):
self.group_by = {'total':'pi', 'per-user':'person'}

def fetch_data(self, payload, search_item=None):
r = requests.get(self.url, params=payload)
r = requests.get(self.url, params=payload, verify=XDMOD_VERIFY)
logger.info(r.url)
logger.info(r.text)

Expand Down

0 comments on commit e6feaff

Please sign in to comment.