marshal with struct
This commit is contained in:
		
							parent
							
								
									d5a578940f
								
							
						
					
					
						commit
						db28339ad3
					
				|  | @ -102,5 +102,5 @@ func (postgresStatus PostgresStatus) Creating() bool { | |||
| } | ||||
| 
 | ||||
| func (postgresStatus PostgresStatus) String() string { | ||||
| 	return fmt.Sprintf(`{"status":{"PostgresClusterStatus": %s}}`, string(postgresStatus.PostgresClusterStatus)) | ||||
| 	return postgresStatus.PostgresClusterStatus | ||||
| } | ||||
|  |  | |||
|  | @ -149,10 +149,15 @@ func (c *Cluster) setProcessName(procName string, args ...interface{}) { | |||
| } | ||||
| 
 | ||||
| // SetStatus of Postgres cluster
 | ||||
| // TODO: eventually switch to updateStatus() for kubernetes 1.11 and above
 | ||||
| func (c *Cluster) setStatus(status string) { | ||||
| 	c.logger.Debugf("updating status to %s", status) | ||||
| 	// TODO: eventually switch to updateStatus() for kubernetes 1.11 and above
 | ||||
| 	patch, err := json.Marshal(acidv1.PostgresStatus{PostgresClusterStatus: status}.String()) | ||||
| 	var pgStatus acidv1.PostgresStatus | ||||
| 	pgStatus.PostgresClusterStatus = status | ||||
| 
 | ||||
| 	patch, err := json.Marshal(struct { | ||||
| 		PgStatus interface{} `json:"status"` | ||||
| 	}{&pgStatus}) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		c.logger.Errorf("could not marshal status: %v", err) | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue