env vars
This commit is contained in:
parent
3c05587f1a
commit
3e5b77ee8d
19
main.py
19
main.py
|
@ -1,7 +1,8 @@
|
|||
# External deps
|
||||
import paramiko
|
||||
import logging
|
||||
from time import sleep
|
||||
import paramiko # for ssh
|
||||
import logging # for possible debugging
|
||||
from time import sleep # for sleep()
|
||||
import os # for CLI arguments
|
||||
|
||||
# Local deps
|
||||
import listServers, relativeUsage
|
||||
|
@ -10,10 +11,16 @@ import listServers, relativeUsage
|
|||
#logging.basicConfig()
|
||||
#logging.getLogger("paramiko").setLevel(logging.DEBUG)
|
||||
|
||||
"""
|
||||
ENV VARIABLES AVAILABLE:
|
||||
- hostname
|
||||
- sshkeylocation (optional)
|
||||
- sshuser (optional)
|
||||
"""
|
||||
# Creds
|
||||
hostname = '172.23.224.40'
|
||||
sshuser = 'Administrator'
|
||||
sshkeylocation = '/home/jc/.ssh/id_rsa'
|
||||
hostname = str(os.environ['hostname'])
|
||||
sshuser = str(os.getenv('sshuser', 'Administrator'))
|
||||
sshkeylocation = str(os.path.abspath( os.getenv('sshkeypath', '~/.ssh/id_rsa') ))
|
||||
|
||||
paramiko.transport.Transport._preferred_keys += ('ssh-dss',) # Allow the insecurities
|
||||
ssh = paramiko.SSHClient() # Alias
|
||||
|
|
Loading…
Reference in New Issue