| | |
| | | hosts=({'name':socket.gethostname(),'address':'127.0.0.1', 'runs':hosts},) |
| | | |
| | | #find the host at which the action is attended |
| | | # print(args) |
| | | if args['host']==None: |
| | | #Only status and version commands are automatically executed on all the hosts. stopping or starting or other actions is not! |
| | | if(args['status']==False and args['version']==False): |
| | | hosts=getListOfHostConfigurationByHostname(hosts,socket.gethostname()) |
| | | # if(args['status']==False and args['version']==False and): |
| | | # hosts=getListOfHostConfigurationByHostname(hosts,socket.gethostname()) |
| | | pass |
| | | else: |
| | | hosts=getListOfHostConfigurationByHostname(hosts,args['host']) |
| | | if len(hosts)==0: |
| | | print ('Hostname "{}" does not exist in configuration file. Please check the spelling'.format(args['host'][0])) |
| | | exit(1) |
| | | if not args['local_only']: |
| | | # print("copying to remotes, DEBUG") |
| | | # print(hosts) |
| | | hosts=copyConfigAndConnect(hosts) |
| | | #do local stuff: |
| | | for host in hosts: |