Skip to content

Commit ebfa724

Browse files
committed
Use data container for the output-file format
Signed-off-by: Richard Wall <[email protected]>
1 parent fc5b21f commit ebfa724

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/agent/run.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
225225
}
226226

227227
dataGatherers := map[string]datagatherer.DataGatherer{}
228-
229228
// load datagatherer config and boot each one
230229
for _, dgConfig := range config.DataGatherers {
231230
kind := dgConfig.Kind
@@ -379,7 +378,17 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf
379378
}
380379

381380
if config.OutputPath != "" {
382-
data, err := json.MarshalIndent(readings, "", " ")
381+
clusterID := clusteruid.ClusterUIDFromContext(ctx)
382+
payload := api.DataReadingsPost{
383+
AgentMetadata: &api.AgentMetadata{
384+
Version: version.PreflightVersion,
385+
ClusterID: clusterID,
386+
},
387+
DataGatherTime: time.Now(),
388+
DataReadings: readings,
389+
}
390+
391+
data, err := json.MarshalIndent(payload, "", " ")
383392
if err != nil {
384393
return fmt.Errorf("failed to marshal JSON: %s", err)
385394
}

0 commit comments

Comments
 (0)