Skip to content

Commit 211b110

Browse files
committed
tts: Strip ids.dev_addr from exported devices
1 parent 5f3093d commit 211b110

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pkg/source/tts/source.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ func (s Source) ExportDevice(devID string) (*ttnpb.EndDevice, error) {
7373
if err := validateDeviceIds(dev.Ids, res.Ids); err != nil {
7474
return nil, err
7575
}
76-
paths := ttnpb.AddFields(nsPaths, ttnpb.AddFields(asPaths, ttnpb.AddFields(jsPaths, "ids.dev_addr")...)...)
76+
paths := ttnpb.AddFields(nsPaths, ttnpb.AddFields(asPaths, jsPaths...)...)
7777
if err := dev.SetFields(res, paths...); err != nil {
7878
return nil, err
7979
}
80+
// Clear ids.dev_addr (denormalized session state) so the export can be
81+
// re-imported via the CLI; session.dev_addr remains the source of truth.
82+
if dev.Ids != nil {
83+
dev.Ids.DevAddr = nil
84+
}
8085
// Clear all "{server}_address" fields from exported device
8186
if err := dev.SetFields(nil, "application_server_address", "join_server_address", "network_server_address"); err != nil {
8287
return nil, err

0 commit comments

Comments
 (0)