-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*: remove support for environment variables
The environment variables were originally added to make CI testing a little easier, since the installer didn't support consumption of provided assets (e.g. the install config). Now that the installer supports consumption, there is no need for most of the environment variables anymore. The variables have actually been confusing to users, so their removal should simplify the mental model.
- Loading branch information
Showing
12 changed files
with
18 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,5 @@ func (a *platform) queryUserForPlatform() (string, error) { | |
return nil | ||
}), | ||
}, | ||
"OPENSHIFT_INSTALL_PLATFORM", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,13 @@ | ||
package asset | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
|
||
"github.com/pkg/errors" | ||
survey "gopkg.in/AlecAivazis/survey.v1" | ||
) | ||
|
||
// GenerateUserProvidedAsset queries for input from the user. | ||
func GenerateUserProvidedAsset(inputName string, question *survey.Question, envVarName string) (string, error) { | ||
return generateUserProvidedAsset(inputName, question, envVarName, "") | ||
} | ||
|
||
// GenerateUserProvidedAssetForPath queries for input from the user. The input can | ||
// be read from a file specified in an environment variable. | ||
func GenerateUserProvidedAssetForPath(inputName string, question *survey.Question, envVarName, pathEnvVarName string) (string, error) { | ||
return generateUserProvidedAsset(inputName, question, envVarName, pathEnvVarName) | ||
} | ||
|
||
func generateUserProvidedAsset(inputName string, question *survey.Question, envVarName, pathEnvVarName string) (response string, err error) { | ||
defer func() { | ||
if err != nil { | ||
err = errors.Wrapf(err, "failed to acquire user-provided input %s", inputName) | ||
} | ||
}() | ||
|
||
if value, ok := os.LookupEnv(envVarName); ok { | ||
response = value | ||
} else if path, ok := os.LookupEnv(pathEnvVarName); ok { | ||
value, err := ioutil.ReadFile(path) | ||
if err != nil { | ||
return "", errors.Wrapf(err, "failed to read file from %s", pathEnvVarName) | ||
} | ||
response = string(value) | ||
} | ||
|
||
if response == "" { | ||
if err := survey.Ask([]*survey.Question{question}, &response); err != nil { | ||
return "", errors.Wrap(err, "failed to Ask") | ||
} | ||
} else if question.Validate != nil { | ||
if err := question.Validate(response); err != nil { | ||
return "", errors.Wrap(err, "validation failed") | ||
} | ||
} | ||
|
||
return response, nil | ||
func GenerateUserProvidedAsset(inputName string, question *survey.Question) (string, error) { | ||
var response string | ||
err := survey.Ask([]*survey.Question{question}, &response) | ||
return response, errors.Wrapf(err, "failed to acquire user-provided input %s", inputName) | ||
} |