Skip to content

Commit

Permalink
fix for oh and up version
Browse files Browse the repository at this point in the history
  • Loading branch information
playground committed Mar 19, 2024
1 parent e361837 commit d31cc14
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 30 deletions.
4 changes: 2 additions & 2 deletions build/common/src/env.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/common/src/env.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions build/common/src/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/common/src/utils.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hzn-cli",
"version": "0.8.8",
"version": "0.8.9",
"description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments",
"main": "./build/index.js",
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions src/common/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class Env {
return `${pEnv.YOUR_DOCKERHUB_ID}/${pEnv.MMS_SERVICE_NAME}`;
}
getMMSContainerCreds() {
return pEnv.MMS_CONTAINER_CREDS;
return pEnv.MMS_CONTAINER_CREDS || '';
}
getMMSPatterName() {
return pEnv.MMS_PATTERN_NAME;
Expand Down Expand Up @@ -181,7 +181,7 @@ export class Env {
return pEnv.MMS_OBJECT_FILE
}
getServiceContainerCreds() {
return pEnv.SERVICE_CONTAINER_CREDS;
return pEnv.SERVICE_CONTAINER_CREDS || '';
}
getServiceContainerName() {
return pEnv.SERVICE_CONTAINER_NAME;
Expand Down
29 changes: 17 additions & 12 deletions src/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ export class Utils {
return this.shell(arg)
} else {
return of()
}
}
}
cleanUp() {
console.log('cleaning up', existsSync(`${this.etcDefault}/horizon`), existsSync(this.etcHorizon), this.etcHorizon)
Expand Down Expand Up @@ -1055,16 +1055,20 @@ export class Utils {
})
}
systemOS() {
let os = readFileSync('/etc/os-release', 'utf8')
let opJson = {}
os?.split('\n')?.forEach((line, index) => {
let words = line?.split('=')
let key = words[0]?.toLowerCase()
if (key === '') return
let value = words[1]?.replace(/"/g,'')
opJson[key] = value
})
return opJson;
try {
let os = readFileSync('/etc/os-release', 'utf8')
os?.split('\n')?.forEach((line, index) => {
let words = line?.split('=')
let key = words[0]?.toLowerCase()
if (key === '') return
let value = words[1]?.replace(/"/g,'')
opJson[key] = value
})
return opJson;
} catch(e) {
return opJson;
}
}
uninstallK8s(msg = 'Would you like to uninstall K8S? Y/n ') {
return new Observable((observer) => {
Expand Down Expand Up @@ -1255,8 +1259,9 @@ export class Utils {
tag = anax.replace('download', 'tag')
}
anax = anax.replace('/agent-install.sh', '')
let icss = css === 'true' || css == true ? '-i css:' : ''
return this.shell(`sudo touch /etc/default/horizon && sudo curl -sSL ${anax}/agent-install.sh | sudo -s -E bash -s -- -i ${tag} ${nodeId} ${icss} -k css: -c css:`)
let icss = css === 'true' || css == true ? '-i css:' : '';
let cfg = process.env.AGENT_INSTALL_CONFIG? `-k ${process.env.AGENT_INSTALL_CONFIG}` : '-k css:';
return this.shell(`sudo touch /etc/default/horizon && sudo curl -sSL ${anax}/agent-install.sh | sudo -s -E bash -s -- -i ${tag} ${nodeId} ${icss} ${cfg} -c css:`)
} else {
// anax = api/v1/objects/IBM/agent_files/agent-install.sh/data
return this.shell(`sudo curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o agent-install.sh $HZN_FSS_CSSURL/${anax} && sudo chmod +x agent-install.sh && sudo -s -E -b ./agent-install.sh -i 'css:' ${nodeId}`)
Expand Down

0 comments on commit d31cc14

Please sign in to comment.