From 05df352896f7b1ac79746b06b63bb8e2907db395 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Sun, 3 Jan 2021 21:45:55 -0800 Subject: [PATCH 1/2] Remove email prompt from CLI --- cli/cmd/cluster.go | 4 ---- cli/cmd/cluster_gcp.go | 4 ---- 2 files changed, 8 deletions(-) diff --git a/cli/cmd/cluster.go b/cli/cmd/cluster.go index 3a2f6f6e03..8b6353c1f1 100644 --- a/cli/cmd/cluster.go +++ b/cli/cmd/cluster.go @@ -164,10 +164,6 @@ var _clusterUpCmd = &cobra.Command{ exit.Error(err) } - if !_flagClusterDisallowPrompt { - promptForEmail() - } - if _flagClusterConfig != "" { // Deprecation: specifying aws creds in cluster configuration is no longer supported if err := detectAWSCredsInConfigFile(cmd.Use, _flagClusterConfig); err != nil { diff --git a/cli/cmd/cluster_gcp.go b/cli/cmd/cluster_gcp.go index 36a4443e8f..0e7bfa4216 100644 --- a/cli/cmd/cluster_gcp.go +++ b/cli/cmd/cluster_gcp.go @@ -131,10 +131,6 @@ var _clusterGCPUpCmd = &cobra.Command{ exit.Error(err) } - if !_flagClusterGCPDisallowPrompt { - promptForEmail() - } - accessConfig, err := getNewGCPClusterAccessConfig(_flagClusterGCPDisallowPrompt) if err != nil { exit.Error(err) From a6654a49257f3903a112764b321468b1241043a1 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Mon, 4 Jan 2021 23:36:52 -0800 Subject: [PATCH 2/2] Delete lib_email.go --- cli/cmd/lib_email.go | 68 -------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 cli/cmd/lib_email.go diff --git a/cli/cmd/lib_email.go b/cli/cmd/lib_email.go deleted file mode 100644 index 61bf1d3149..0000000000 --- a/cli/cmd/lib_email.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2020 Cortex Labs, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cmd - -import ( - cr "github.com/cortexlabs/cortex/pkg/lib/configreader" - "github.com/cortexlabs/cortex/pkg/lib/exit" - "github.com/cortexlabs/cortex/pkg/lib/files" - "github.com/cortexlabs/cortex/pkg/lib/prompt" - "github.com/cortexlabs/cortex/pkg/lib/telemetry" -) - -var _emailPrompValidation = &cr.PromptValidation{ - PromptItemValidations: []*cr.PromptItemValidation{ - { - StructField: "EmailAddress", - PromptOpts: &prompt.Options{ - Prompt: "email address [press enter to skip]", - }, - StringPtrValidation: &cr.StringPtrValidation{ - Required: false, - Validator: cr.EmailValidator, - }, - }, - }, -} - -func promptForEmail() { - if email, err := files.ReadFile(_emailPath); err == nil && email != "" { - return - } - - emailAddressContainer := &struct { - EmailAddress *string - }{} - err := cr.ReadPrompt(emailAddressContainer, _emailPrompValidation) - if err != nil { - exit.Error(err) - } - - if emailAddressContainer.EmailAddress != nil { - if !isTelemetryEnabled() { - initTelemetry() - } - - telemetry.RecordEmail(*emailAddressContainer.EmailAddress) - - if !isTelemetryEnabled() { - telemetry.Close() - } - - files.WriteFile([]byte(*emailAddressContainer.EmailAddress), _emailPath) - } -}