def do_ssh(self, args, arguments): """ :: Usage: ssh list [--format=json|yaml] ssh register NAME COMMANDS ssh NAME conducts a ssh login into a machine while using a set of registered commands under the name of the machine. Arguments: NAME Name of the machine to log in list Lists the machines that are registered and the commands to login to them register Register the commands to a name COMMANDS The list of commands executed when issuing a name Options: -v verbose mode """ pprint(arguments) if arguments["list"]: if 'json' == arguments["--format"]: print (print_format_dict(self.ssh_machines, kind='json')) elif 'yaml' == arguments["--format"]: print (print_format_dict(self.ssh_machines, kind='yaml')) else: print (two_column_table(self.ssh_machines, header=['Machines', 'Commands'])) elif arguments["register"]: Console.error("NOT YET IMPLEMENTED") else: machine = arguments["NAME"] if machine in self.ssh_machines: commands = self.ssh_machines[machine] print (commands) Console.info ("login to " + machine) os.system(commands) else: Console.error("machine " + machine + " not found") # shell_command_open_ssh(arguments) pass
self.projects.add(project,'completed') self.projects.delete(project,'default') self.projects.write() self.cm_user.delete_projects(self.username, project) self.cm_user.add_completed_projects(self.username, project) self._load_projects() msg = '{0} project is in a completed project(s)'.format(project) log.info(msg) print(msg) return else: # log.info ("project info for all") if arguments["--format"] == "json": a = json.loads(self.projects.dump()) print(print_format_dict(a, kind='json')) return else: a = json.loads(self.projects.dump()) print(two_column_table(a)) ''' print print "Project Information" print "-------------------" print if self.projects.names("default") is not "" and not []: print "%10s:" % "default", self.projects.names("default") else: print "%10s:" % "default ", \ "default is not set, please set it"