Skip to content

Commit

Permalink
Merge pull request #109 from playground/oh-mesh
Browse files Browse the repository at this point in the history
Oh mesh
  • Loading branch information
playground authored Feb 29, 2024
2 parents c3eae49 + 67523d8 commit 5a31083
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 46 deletions.
19 changes: 7 additions & 12 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.1",
"version": "0.8.2",
"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
58 changes: 26 additions & 32 deletions src/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class Utils {
}
proceedWithAutoInstall(params: IAutoParam, setup: SetupEnvironment, purge = true) {
return new Observable((observer) => {
// console.log('hzn_css', pEnv.HZN_CSS, typeof pEnv.HZN_CSS, Boolean(pEnv.HZN_CSS))
console.log('proceedWithAutoInstall', setup)
this.purgeManagementHub(purge) // Leverage this function to cleanup and install prerequisites, maynot need preInstallHznCli anymore
.subscribe({
complete: () => {
Expand Down Expand Up @@ -429,7 +429,8 @@ export class Utils {
observer.complete()
} else if(setup == SetupEnvironment.autoSetupAllInOne || setup == SetupEnvironment.autoSetupCliInContainer || setup == SetupEnvironment.autoSetupAnaxInContainer || setup == SetupEnvironment.autoSetupContainer || setup == SetupEnvironment.autoSetupOpenHorizonMesh) {
const purge = setup != SetupEnvironment.autoSetupOpenHorizonMesh;
let configJson
let configJson;
console.log('autoRun', setup)
this.updateConfig(configFile)
.subscribe({
next: (json) => {
Expand Down Expand Up @@ -981,15 +982,14 @@ export class Utils {
}
unregisterMeshAgent(params: IHznParam) {
const pEnv = process.env;
const arg = `curl -sL --insecure -u $HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH -X DELETE ${pEnv.HZN_EXCHANGE_URL}/v1/orgs/${pEnv.HZN_ORG_ID}/nodes/${pEnv.HZN_DEVICE_ID}`;
//curl -sL --insecure -u "Tenant3_Corp/ohuser:spqmt@M3u43v4<7u" -X DELETE https://ibm-edge-exchange-preprod.multicloud-mesh-preprod.test.cloud.ibm.com/v1/orgs/Tenant3_Corp/nodes/fyre-cluster-frontend-ns-agent
const arg = `curl -sL --insecure -u $HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH -X DELETE ${pEnv.HZN_EXCHANGE_URL}/orgs/${pEnv.HZN_ORG_ID}/nodes/${pEnv.HZN_DEVICE_ID}`;
//const arg = `kubectl -n ohmesh3-frontend-ns exec -i agent-769d687ff9-8kssh -- hzn unregister -r -f --timeout 3`;
//const arg = `kubectl -n ${pEnv.AGENT_NAMESPACE} exec -i ${params.name} -- hzn unregister -r -f --timeout 3`;
return this.shell(arg);
}
unregisterMeshAgentByName(params: IHznParam) {
const pEnv = process.env;
//const arg = `curl -sL --insecure -u $HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH -X DELETE ${pEnv.HZN_EXCHANGE_URL}/v1/orgs/${pEnv.HZN_ORG_ID}/nodes/${pEnv.HZN_DEVICE_ID}`;
//const arg = `kubectl -n ohmesh3-frontend-ns exec -i agent-769d687ff9-8kssh -- hzn unregister -r -f --timeout 3`;
const arg = `kubectl -n ${pEnv.AGENT_NAMESPACE} exec -i ${params.name} -- hzn unregister -r -f --timeout 3`;
return this.shell(arg);
}
Expand Down Expand Up @@ -1046,38 +1046,32 @@ export class Utils {
setupOpenHorizonMesh(params: IAutoParam, anax: string) {
return new Observable((observer) => {
const pEnv = process.env;
//this.installCliOnly(anax)
//.subscribe({
// complete: () => {
const k8s = params.k8s;
let arg = '';
let $shell: any;
if(k8s == 'K3S') {
$shell = this.installK3s(params);
} else if(k8s == 'K8S') {
const k8s = params.k8s;
let arg = '';
let $shell: any;
if(k8s == 'K3S') {
$shell = this.installK3s(params);
} else if(k8s == 'K8S') {

}
if($shell) {
$shell
} else {
$shell = of();
}
if($shell) {
$shell
.subscribe({
complete: ()=> {
this.registerMeshAgent()
.subscribe({
complete: ()=> {
this.registerMeshAgent()
.subscribe({
complete: () => {
observer.next();
observer.complete();
},
error: (err) => observer.error(err)
})
complete: () => {
observer.next();
observer.complete();
},
error: (err) => observer.error(err)
})
}
//},
// error: (err) => {
// observer.error(err)
// }
//})
},
error: (err) => observer.error(err)
})
}
})
}
installCliOnly(anax: string) {
Expand Down

0 comments on commit 5a31083

Please sign in to comment.