Skip to content

Commit c00828c

Browse files
committed
[yugabyte#5592] Do not set YB_HOME_DIR in onprem provider config if empty
Summary: This changed in yugabyte@42cc19e. This diff changes the java and python code to handle an empty YB_HOME_DIR better but also removes the empty YB_HOME_DIR if it was not set by the user. This is consistent with the way other providers take optional parameters. Test Plan: 1. Create an onprem provider with an home dir set, verify it goes through and that YB_HOME_DIR is not set. 2. Create a provider without the UI fix. Check that YB_HOME_DIR is set to empty in the provider. Create a universe with this provider, verify it goes through. Reviewers: wesley, daniel Reviewed By: daniel Subscribers: jenkins-bot, yugaware Differential Revision: https://phabricator.dev.yugabyte.com/D9316
1 parent e96c786 commit c00828c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

managed/devops/opscli/ybops/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
RELEASE_REPOS = set(["devops", "yugaware", "yugabyte"])
5555

5656
# Home directory of node instances. Try to read home dir from env, else assume it's /home/yugabyte.
57-
YB_HOME_DIR = os.environ.get("YB_HOME_DIR", "/home/yugabyte")
57+
YB_HOME_DIR = os.environ.get("YB_HOME_DIR") or "/home/yugabyte"
5858

5959

6060
class ReleasePackage(object):

managed/src/main/java/com/yugabyte/yw/models/Provider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ public Map<String, String> getConfig() {
9595

9696
@JsonIgnore
9797
public String getYbHome() {
98-
return this.getConfig().getOrDefault("YB_HOME_DIR", DEFAULT_YB_HOME_DIR);
98+
String ybHomeDir = this.getConfig().getOrDefault("YB_HOME_DIR", "");
99+
if (ybHomeDir.isEmpty()) {
100+
ybHomeDir = DEFAULT_YB_HOME_DIR;
101+
}
102+
return ybHomeDir;
99103
}
100104

101105
/**

managed/ui/src/components/config/OnPrem/wizard/OnPremProviderAndAccessKeyContainer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const mapStateToProps = (state, ownProps) => {
3838
sshPort: 54422,
3939
passwordlessSudoAccess: true,
4040
airGapInstall: false,
41-
useHostnames: false,
42-
homeDir: ""
41+
useHostnames: false
4342
};
4443
const {cloud: {onPremJsonFormData}} = state;
4544
if (ownProps.isEditProvider && isNonEmptyObject(onPremJsonFormData)) {

0 commit comments

Comments
 (0)