|  |  |  | @ -53,7 +53,7 @@ func cleanUp(domainName string) { | 
		
	
		
			
				|  |  |  |  | // Docker manages SSH connection details. These are stored to disk in | 
		
	
		
			
				|  |  |  |  | // ~/.docker. Abra can manage this completely for the user, so it's an | 
		
	
		
			
				|  |  |  |  | // implementation detail. | 
		
	
		
			
				|  |  |  |  | func newContext(c *cli.Context, domainName, username, port string) error { | 
		
	
		
			
				|  |  |  |  | func newContext(c *cli.Context, name, host, username, port string) error { | 
		
	
		
			
				|  |  |  |  | 	store := contextPkg.NewDefaultDockerContextStore() | 
		
	
		
			
				|  |  |  |  | 	contexts, err := store.Store.List() | 
		
	
		
			
				|  |  |  |  | 	if err != nil { | 
		
	
	
		
			
				
					
					|  |  |  | @ -61,15 +61,15 @@ func newContext(c *cli.Context, domainName, username, port string) error { | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 	for _, context := range contexts { | 
		
	
		
			
				|  |  |  |  | 		if context.Name == domainName { | 
		
	
		
			
				|  |  |  |  | 			logrus.Debugf("context for %s already exists", domainName) | 
		
	
		
			
				|  |  |  |  | 		if context.Name == name { | 
		
	
		
			
				|  |  |  |  | 			logrus.Debugf("context for %s already exists", name) | 
		
	
		
			
				|  |  |  |  | 			return nil | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 	logrus.Debugf("creating context with domain %s, username %s and port %s", domainName, username, port) | 
		
	
		
			
				|  |  |  |  | 	logrus.Debugf("creating context with name %s, host %s, username %s and port %s", name, host, username, port) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 	if err := client.CreateContext(domainName, username, port); err != nil { | 
		
	
		
			
				|  |  |  |  | 	if err := client.CreateContext(name, host, username, port); err != nil { | 
		
	
		
			
				|  |  |  |  | 		return err | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
	
		
			
				
					
					|  |  |  | @ -112,11 +112,16 @@ Abra can then load SSH connection details from this configuratiion with: | 
		
	
		
			
				|  |  |  |  | If "--local" is passed, then Abra assumes that the current local server is | 
		
	
		
			
				|  |  |  |  | intended as the target server. This is useful when you want to have your entire | 
		
	
		
			
				|  |  |  |  | Co-op Cloud config located on the server itself, and not on your local | 
		
	
		
			
				|  |  |  |  | developer machine. | 
		
	
		
			
				|  |  |  |  | developer machine. The domain is then set to "default". | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | You can also pass "--no-domain-checks" flag to use any arbitrary name instead | 
		
	
		
			
				|  |  |  |  | of a real domain. Host will be resolved with the "hostname" entry of your SSH | 
		
	
		
			
				|  |  |  |  | configuration. Checks for a valid online domain will be skipped. | 
		
	
		
			
				|  |  |  |  | `, | 
		
	
		
			
				|  |  |  |  | 	Flags: []cli.Flag{ | 
		
	
		
			
				|  |  |  |  | 		internal.DebugFlag, | 
		
	
		
			
				|  |  |  |  | 		internal.NoInputFlag, | 
		
	
		
			
				|  |  |  |  | 		internal.NoDomainChecksFlag, | 
		
	
		
			
				|  |  |  |  | 		localFlag, | 
		
	
		
			
				|  |  |  |  | 	}, | 
		
	
		
			
				|  |  |  |  | 	Before:    internal.SubCommandBefore, | 
		
	
	
		
			
				
					
					|  |  |  | @ -150,20 +155,26 @@ developer machine. | 
		
	
		
			
				|  |  |  |  | 			return nil | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		if _, err := dns.EnsureIPv4(domainName); err != nil { | 
		
	
		
			
				|  |  |  |  | 			logrus.Fatal(err) | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		if err := createServerDir(domainName); err != nil { | 
		
	
		
			
				|  |  |  |  | 			logrus.Fatal(err) | 
		
	
		
			
				|  |  |  |  | 		if !internal.NoDomainChecks { | 
		
	
		
			
				|  |  |  |  | 			if _, err := dns.EnsureIPv4(domainName); err != nil { | 
		
	
		
			
				|  |  |  |  | 				logrus.Fatal(err) | 
		
	
		
			
				|  |  |  |  | 			} | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		hostConfig, err := sshPkg.GetHostConfig(domainName) | 
		
	
		
			
				|  |  |  |  | 		if err != nil { | 
		
	
		
			
				|  |  |  |  | 			logrus.Fatal(err) | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		if hostConfig.Host == "" { | 
		
	
		
			
				|  |  |  |  | 			hostConfig.Host = domainName | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		if err := newContext(c, domainName, hostConfig.User, hostConfig.Port); err != nil { | 
		
	
		
			
				|  |  |  |  | 		if err := createServerDir(domainName); err != nil { | 
		
	
		
			
				|  |  |  |  | 			logrus.Fatal(err) | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | 		if err := newContext(c, domainName, hostConfig.Host, hostConfig.User, hostConfig.Port); err != nil { | 
		
	
		
			
				|  |  |  |  | 			cleanUp(domainName) | 
		
	
		
			
				|  |  |  |  | 			logrus.Fatal(err) | 
		
			
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
	
		
			
				
					
					|  |  |  | 
 | 
		
	
										
									
								
							
Doesn't this need to go before the
logrus.Fatalcall?Good catch, thanks!