ocket8888 commented on a change in pull request #4985:
URL: https://github.com/apache/trafficcontrol/pull/4985#discussion_r476111094
##########
File path: traffic_ops/traffic_ops_golang/server/put_status.go
##########
@@ -156,10 +157,12 @@ func updateServerStatusAndOfflineReason(serverID,
statusID int, offlineReason *s
q := `
UPDATE server
SET status = $1,
- offline_reason = $2
-WHERE id = $3
+ offline_reason = $2,
+ status_last_updated = $3
Review comment:
You can actually just set this to `NOW()` right in the query, no need to
interpolate.
##########
File path: lib/go-tc/servers.go
##########
@@ -342,45 +343,46 @@ type ServerV1 struct {
// CommonServerProperties is just the collection of properties which are
// shared by all servers across API versions.
type CommonServerProperties struct {
- Cachegroup *string `json:"cachegroup"
db:"cachegroup"`
- CachegroupID *int `json:"cachegroupId"
db:"cachegroup_id"`
- CDNID *int `json:"cdnId" db:"cdn_id"`
- CDNName *string `json:"cdnName" db:"cdn_name"`
- DeliveryServices *map[string][]string
`json:"deliveryServices,omitempty"`
- DomainName *string `json:"domainName"
db:"domain_name"`
- FQDN *string `json:"fqdn,omitempty"`
- FqdnTime time.Time `json:"-"`
- GUID *string `json:"guid" db:"guid"`
- HostName *string `json:"hostName" db:"host_name"`
- HTTPSPort *int `json:"httpsPort" db:"https_port"`
- ID *int `json:"id" db:"id"`
- ILOIPAddress *string `json:"iloIpAddress"
db:"ilo_ip_address"`
- ILOIPGateway *string `json:"iloIpGateway"
db:"ilo_ip_gateway"`
- ILOIPNetmask *string `json:"iloIpNetmask"
db:"ilo_ip_netmask"`
- ILOPassword *string `json:"iloPassword"
db:"ilo_password"`
- ILOUsername *string `json:"iloUsername"
db:"ilo_username"`
- LastUpdated *TimeNoMod `json:"lastUpdated"
db:"last_updated"`
- MgmtIPAddress *string `json:"mgmtIpAddress"
db:"mgmt_ip_address"`
- MgmtIPGateway *string `json:"mgmtIpGateway"
db:"mgmt_ip_gateway"`
- MgmtIPNetmask *string `json:"mgmtIpNetmask"
db:"mgmt_ip_netmask"`
- OfflineReason *string `json:"offlineReason"
db:"offline_reason"`
- PhysLocation *string `json:"physLocation"
db:"phys_location"`
- PhysLocationID *int `json:"physLocationId"
db:"phys_location_id"`
- Profile *string `json:"profile" db:"profile"`
- ProfileDesc *string `json:"profileDesc"
db:"profile_desc"`
- ProfileID *int `json:"profileId" db:"profile_id"`
- Rack *string `json:"rack" db:"rack"`
- RevalPending *bool `json:"revalPending"
db:"reval_pending"`
- RouterHostName *string `json:"routerHostName"
db:"router_host_name"`
- RouterPortName *string `json:"routerPortName"
db:"router_port_name"`
- Status *string `json:"status" db:"status"`
- StatusID *int `json:"statusId" db:"status_id"`
- TCPPort *int `json:"tcpPort" db:"tcp_port"`
- Type string `json:"type" db:"server_type"`
- TypeID *int `json:"typeId"
db:"server_type_id"`
- UpdPending *bool `json:"updPending"
db:"upd_pending"`
- XMPPID *string `json:"xmppId" db:"xmpp_id"`
- XMPPPasswd *string `json:"xmppPasswd"
db:"xmpp_passwd"`
+ Cachegroup *string `json:"cachegroup"
db:"cachegroup"`
+ CachegroupID *int `json:"cachegroupId"
db:"cachegroup_id"`
+ CDNID *int `json:"cdnId" db:"cdn_id"`
+ CDNName *string `json:"cdnName" db:"cdn_name"`
+ DeliveryServices *map[string][]string
`json:"deliveryServices,omitempty"`
+ DomainName *string `json:"domainName"
db:"domain_name"`
+ FQDN *string `json:"fqdn,omitempty"`
+ FqdnTime time.Time `json:"-"`
+ GUID *string `json:"guid" db:"guid"`
+ HostName *string `json:"hostName" db:"host_name"`
+ HTTPSPort *int `json:"httpsPort"
db:"https_port"`
+ ID *int `json:"id" db:"id"`
+ ILOIPAddress *string `json:"iloIpAddress"
db:"ilo_ip_address"`
+ ILOIPGateway *string `json:"iloIpGateway"
db:"ilo_ip_gateway"`
+ ILOIPNetmask *string `json:"iloIpNetmask"
db:"ilo_ip_netmask"`
+ ILOPassword *string `json:"iloPassword"
db:"ilo_password"`
+ ILOUsername *string `json:"iloUsername"
db:"ilo_username"`
+ LastUpdated *TimeNoMod `json:"lastUpdated"
db:"last_updated"`
+ MgmtIPAddress *string `json:"mgmtIpAddress"
db:"mgmt_ip_address"`
+ MgmtIPGateway *string `json:"mgmtIpGateway"
db:"mgmt_ip_gateway"`
+ MgmtIPNetmask *string `json:"mgmtIpNetmask"
db:"mgmt_ip_netmask"`
+ OfflineReason *string `json:"offlineReason"
db:"offline_reason"`
+ PhysLocation *string `json:"physLocation"
db:"phys_location"`
+ PhysLocationID *int `json:"physLocationId"
db:"phys_location_id"`
+ Profile *string `json:"profile" db:"profile"`
+ ProfileDesc *string `json:"profileDesc"
db:"profile_desc"`
+ ProfileID *int `json:"profileId"
db:"profile_id"`
+ Rack *string `json:"rack" db:"rack"`
+ RevalPending *bool `json:"revalPending"
db:"reval_pending"`
+ RouterHostName *string `json:"routerHostName"
db:"router_host_name"`
+ RouterPortName *string `json:"routerPortName"
db:"router_port_name"`
+ Status *string `json:"status" db:"status"`
+ StatusID *int `json:"statusId" db:"status_id"`
+ TCPPort *int `json:"tcpPort" db:"tcp_port"`
+ Type string `json:"type" db:"server_type"`
+ TypeID *int `json:"typeId"
db:"server_type_id"`
+ UpdPending *bool `json:"updPending"
db:"upd_pending"`
+ XMPPID *string `json:"xmppId" db:"xmpp_id"`
+ XMPPPasswd *string `json:"xmppPasswd"
db:"xmpp_passwd"`
+ StatusLastUpdated time.Time `json:"statusLastUpdated"
db:"status_last_updated"`
Review comment:
This, unfortunately, cannot be done. It changes the structures returned
by all client methods. Those need to stay frozen at whatever they were prior to
API v3, and this new field must be added only to the APIv3 Server object.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]