Skip to content

Commit

Permalink
fix: json format
Browse files Browse the repository at this point in the history
  • Loading branch information
aby913 committed Jul 27, 2024
1 parent 2063cfd commit 5a31258
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions pkg/kubesphere/plugins/kscore_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ type PatchKsCoreStatus struct {

func (t *PatchKsCoreStatus) Execute(runtime connector.Runtime) error {
// ! todo need test on linux
// var jsonPath = fmt.Sprintf(`{\"status\": {\"core\": {\"status\": \"enabled\", \"enabledTime\": \"%s\"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
var jsonPath = fmt.Sprintf(`{"status": {"core": {"status": "enabled", "enabledTime": "%s"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
var jsonPath = fmt.Sprintf(`{\"status\": {\"core\": {\"status\": \"enabled\", \"enabledTime\": \"%s\"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
if runtime.GetRunner().Host.GetMinikube() {
jsonPath = fmt.Sprintf(`{"status": {"core": {"status": "enabled", "enabledTime": "%s"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
}
var cmd = fmt.Sprintf("/usr/local/bin/kubectl patch cc ks-installer --type merge -p '%s' -n %s", jsonPath, common.NamespaceKubesphereSystem)

_, err := runtime.GetRunner().SudoCmd(cmd, false, true)
Expand Down
12 changes: 6 additions & 6 deletions pkg/kubesphere/plugins/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ type PatchRedisStatus struct {
}

func (t *PatchRedisStatus) Execute(runtime connector.Runtime) error {
// var jsonPatch = fmt.Sprintf(`{\"status\": {\"redis\": {\"status\": \"enabled\", \"enabledTime\": \"%s\"}}}`,
// time.Now().Format("2006-01-02T15:04:05Z"))
// if runtime.GetRunner().Host.GetMinikube() {

// }
var jsonPatch = fmt.Sprintf(`{\"status\": {\"redis\": {\"status\": \"enabled\", \"enabledTime\": \"%s\"}}}`,
time.Now().Format("2006-01-02T15:04:05Z"))
if runtime.GetRunner().Host.GetMinikube() {
jsonPatch = fmt.Sprintf(`{"status": {"redis": {"status": "enabled", "enabledTime": "%s"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
}
// todo fix
var jsonPatch = fmt.Sprintf(`{"status": {"redis": {"status": "enabled", "enabledTime": "%s"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
// var jsonPatch = fmt.Sprintf(`{"status": {"redis": {"status": "enabled", "enabledTime": "%s"}}}`, time.Now().Format("2006-01-02T15:04:05Z"))
var cmd = fmt.Sprintf("/usr/local/bin/kubectl patch cc ks-installer --type merge -p '%s' -n %s", jsonPatch, common.NamespaceKubesphereSystem)

_, err := runtime.GetRunner().SudoCmd(cmd, false, true)
Expand Down

0 comments on commit 5a31258

Please sign in to comment.