Skip to content

Commit

Permalink
Issue #7: argo login correctly prompts user to proceed insecurely f…
Browse files Browse the repository at this point in the history
…or SSL certificate related failures. symlink default config if not present during installation
  • Loading branch information
jessesuen committed Aug 24, 2017
1 parent 0e1c20a commit 877ca35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion common/python/ax/cluster_management/app/cluster_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
DEFAULT_NODE_SPOT_PRICE = "0.1512"
CLUSTER_META_DATA_PATH = "/tmp/cluster_meta/metadata.yaml"
ARGO_CONFIG = "/root/.argo/{fname}"
ARGO_CONFIG_DEFAULT = ARGO_CONFIG.format(fname='default')


class ClusterInstaller(ClusterOperationBase):
Expand Down Expand Up @@ -104,7 +105,8 @@ def run(self):
# Dump Argo cluster profile
if username and password:
logger.info("Generating Argo cluster profile ...")
with open(ARGO_CONFIG.format(fname=self._idobj.get_cluster_name_id()), "w") as f:
argo_config_path = ARGO_CONFIG.format(fname=self._idobj.get_cluster_name_id())
with open(argo_config_path, "w") as f:
f.write(
"""
insecure: true
Expand All @@ -113,6 +115,9 @@ def run(self):
username: {username}
""".format(password=password, dns=cluster_dns, username=username)
)
if not os.path.exists(ARGO_CONFIG_DEFAULT):
# if user has not yet configured default argo config, symlink a default config to the one just created
os.symlink(os.path.basename(argo_config_path), ARGO_CONFIG_DEFAULT)

summary = """
Cluster Name: {cluster_name}
Expand Down
2 changes: 1 addition & 1 deletion saas/argocli/src/applatix.io/argo/cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var loginCmd = &cobra.Command{
if axErr != nil {
// TODO: need to completely rework axerror to preserve original,
// underlying error and not rely on this clunky string search
if axErr.Code == axerror.ERR_AX_HTTP_CONNECTION.Code && strings.Contains(axErr.Message, "certificate is not valid") {
if axErr.Code == axerror.ERR_AX_HTTP_CONNECTION.Code && (strings.Contains(axErr.Message, "certificate is not valid") || strings.Contains(axErr.Message, "certificate is valid for")) {
fmt.Printf("Cluster is using an invalid or self-signed certificate. Proceed insecurely (y/n)? ")
insecure, _ := reader.ReadString('\n')
insecure = strings.TrimSpace(strings.ToLower(insecure))
Expand Down

0 comments on commit 877ca35

Please sign in to comment.