@@ -23,7 +23,9 @@ func fromInvOSUpdateRunResource(invOSUpdateRunResource *inv_computev1.OSUpdateRu
2323 parseTimestamp := func (ts string ) (* timestamppb.Timestamp , error ) {
2424 if ts == "" {
2525 zlog .Warn ().Msgf ("timestamp is empty" )
26- return nil , nil
26+ return nil , errors .Errorfc (
27+ codes .InvalidArgument , "timestamp is empty" ,
28+ )
2729 }
2830 parsedTime , err := time .Parse (ISO8601TimeFormat , ts )
2931 if err != nil {
@@ -42,23 +44,23 @@ func fromInvOSUpdateRunResource(invOSUpdateRunResource *inv_computev1.OSUpdateRu
4244 return nil , err
4345 }
4446 invStatusTimestamp , err := parseTimestamp (invOSUpdateRunResource .GetStatusTimestamp ())
45- if err != nil {
47+ if err != nil && err . Error () != errors . Errorfc ( codes . InvalidArgument , "timestamp is empty" ). Error () {
4648 zlog .Warn ().Msgf ("Status timestamp parsing failed for OS Update Run resource: %s" , invOSUpdateRunResource .GetResourceId ())
4749 return nil , errors .Errorfc (
4850 codes .InvalidArgument , "status timestamp parsing failed for OS Update Run resource: %s" ,
4951 invOSUpdateRunResource .GetResourceId (),
5052 )
5153 }
5254 invStartTime , err := parseTimestamp (invOSUpdateRunResource .GetStartTime ())
53- if err != nil {
55+ if err != nil && err . Error () != errors . Errorfc ( codes . InvalidArgument , "timestamp is empty" ). Error () {
5456 zlog .Warn ().Msgf ("Start time parsing failed for OS Update Run resource: %s" , invOSUpdateRunResource .GetResourceId ())
5557 return nil , errors .Errorfc (
5658 codes .InvalidArgument , "start time parsing failed for OS Update Run resource: %s" ,
5759 invOSUpdateRunResource .GetResourceId (),
5860 )
5961 }
6062 invEndTime , err := parseTimestamp (invOSUpdateRunResource .GetEndTime ())
61- if err != nil {
63+ if err != nil && err . Error () != errors . Errorfc ( codes . InvalidArgument , "timestamp is empty" ). Error () {
6264 zlog .Warn ().Msgf ("End time parsing failed for OS Update Run resource: %s" , invOSUpdateRunResource .GetResourceId ())
6365 return nil , errors .Errorfc (
6466 codes .InvalidArgument , "end time parsing failed for OS Update Run resource: %s" ,
@@ -113,7 +115,8 @@ func (is *InventorygRPCServer) ListOSUpdateRun(ctx context.Context, req *restv1.
113115 for _ , invRes := range invResp .GetResources () {
114116 osUpdateRunResource , err := fromInvOSUpdateRunResource (invRes .GetResource ().GetOsUpdateRun ())
115117 if err != nil {
116- zlog .InfraErr (err ).Msgf ("Failed to convert inventory OS Update Run resource %s" , invRes .GetResource ().GetOsUpdateRun ().GetResourceId ())
118+ zlog .InfraErr (err ).Msgf ("Failed to convert inventory OS Update Run resource %s" ,
119+ invRes .GetResource ().GetOsUpdateRun ().GetResourceId ())
117120 return nil , errors .Wrap (err )
118121 }
119122 osUpdateRunResources = append (osUpdateRunResources , osUpdateRunResource )
0 commit comments