Browse Source

Updates ssh_manager to have a sub manager menu

pull/11/head
jrtechs 7 years ago
parent
commit
8ec811e883
1 changed files with 57 additions and 4 deletions
  1. +57
    -4
      src/ssh_manager.py

+ 57
- 4
src/ssh_manager.py View File

@ -10,7 +10,7 @@ import module
INPUT_FILE = "/home/jeff/scripts/servers.txt"
Computer = collections.namedtuple("Computer", ('host', 'menue_id'))
WELCOME_MESSAGE = "*************Jeff-Laptop***************"
WELCOME_MESSAGE = "*************Jeff-Tower***************"
def print_welcome_message():
@ -46,23 +46,76 @@ def main():
cmp.append(Computer(line, count))
count += 1
print("* SSH manager V 0.1 *")
print("* SSH manager V 0.2 *")
for c in cmp:
print_menu_option(str(c.menue_id) + ") " + c.host)
print_menu_option("A/' ') Exit")
print_menu_option("B/' ') Manager tools")
print("*" * len(WELCOME_MESSAGE))
i = input("Enter number of computer to connect to or enter to exit:")
if i == '':
if i == '' or i == 'A' or i == 'a':
subprocess.call(["clear"])
elif i == 'b' or i == 'B':
subMenu()
else:
for c in cmp:
if int(i) == c.menue_id:
subprocess.call(["ssh", c.host])
def printSubMenu():
"""
prints out a sub help menu for other options
:return: None
"""
print("**************************************")
print("* SSH manager V 0.2 Options *")
print_menu_option("1) Add Host")
print_menu_option("2) Copy SSH key to server")
print_menu_option("3) Remove host name")
print_menu_option("4) Return to ssh manager")
print_menu_option("5) Exit")
print("*" * len(WELCOME_MESSAGE))
def subMenu():
"""
calls printSubMenu and then gets input from user to make appropriate function calls
:return: None
"""
printSubMenu()
input = input("Enter selection:")
def addHost():
"""
appends an inputted host name to servers.txt
:return: None
"""
pass
def copySSHKey():
"""
calls systems ssh-copy-id with host name
:return: None
"""
pass
def removeHost():
"""
Removes a host name from servers.txt
:return: None
"""
pass
"""
Makes sure that other programs don't execute the main
"""
if __name__ == '__main__':
main()
main()

Loading…
Cancel
Save