Browse Source

a few more sas-viya changes

master
Gerry Nelson 5 years ago
parent
commit
39f61dd13a
  1. 27
      loginviauthinfo.py
  2. 2
      snapshotreports.py

27
loginviauthinfo.py

@ -57,14 +57,19 @@ except ImportError:
from urlparse import urlparse
# CHANGE THIS VARIABLE IF YOUR CLI IS IN A DIFFERENT LOCATION
clidir='/opt/sas/viya/home/bin/'
#clidir='c:\\admincli\\'
# get cli location from properties
propertylist=getapplicationproperties()
clidir=propertylist["sascli.location"]
cliexe=propertylist["sascli.executable"]
clicommand=os.path.join(clidir,cliexe)
debug=0
profileexists=0
# get input parameters
# get input parameters
parser = argparse.ArgumentParser(description="Authinfo File")
parser.add_argument("-f","--file", help="Enter the path to the authinfo file.",default='.authinfo')
args = parser.parse_args()
@ -84,12 +89,12 @@ badprofile=0
#profile does not exist
if access_file==False:
badprofile=1
badprofile=1
host='default'
#profile is empty file
if os.stat(endpointfile).st_size==0:
if os.stat(endpointfile).st_size==0:
badprofile=1
host='default'
@ -124,11 +129,11 @@ if profileexists:
print('user: '+username)
print('profile: '+myprofile)
print('host: '+host)
#quote the password string for posix systems
if (os.name =='posix'): command=clidir+"sas-admin --profile "+myprofile+ " auth login -u "+username+ " -p '"+password+"'"
else: command=clidir+'sas-admin --profile '+myprofile+ ' auth login -u '+username+ ' -p '+password
if (os.name =='posix'): command=clicommand+" --profile "+myprofile+ " auth login -u "+username+ " -p '"+password+"'"
else: command=clicommand+' --profile '+myprofile+ ' auth login -u '+username+ ' -p '+password
subprocess.call(command, shell=True)
else:
print('ERROR: '+fname+' does not exist')
print('ERROR: '+fname+' does not exist')

2
snapshotreports.py

@ -173,7 +173,7 @@ if areyousure.upper() =='Y':
#time.sleep(1)
if autotranferremove:
print(clicommand+' transfer delete --id '+package_id+"\n")
remTransferObject = subprocess.Popen(clidir+'sas-admin transfer delete --id '+package_id, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
remTransferObject = subprocess.Popen(clicommand+' transfer delete --id '+package_id, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
remTransferObjectOutput = remTransferObject.communicate(b'Y\n')
remTransferObject.wait()

Loading…
Cancel
Save