Skip to content

Fix inconsistencies in devices import/export - #4401

Open
Voriaz wants to merge 9 commits into
phpipam:masterfrom
Voriaz:master
Open

Fix inconsistencies in devices import/export#4401
Voriaz wants to merge 9 commits into
phpipam:masterfrom
Voriaz:master

Conversation

@Voriaz

@Voriaz Voriaz commented Feb 21, 2025

Copy link
Copy Markdown

Hello,

Here is my small contribution to fix some inconsistencies in devices import/export feature that were making export, modify and re-import impossible:

  • Issue#1: Export was putting following fields names: "type" and "sections" VS Import was expecting "deviceType" and "section"
  • Issue#2: Sections were exported as an array of section IDs VS Import was expecting a single section name

I'm proposing the following fixes:

  • Issue#1: Export and Import are now using the same field names ("type" & "sections"), and match the one in the Database. Provided xls Template as been updated too.
  • Issue#2: When exporting, sections ID(s) are now resolved to name(s). When importing, section name(s) are then resolved back to ID(s)

Seems to fix Issues #2838 #4130 #2464 #1894

Please let me know if this is ok to be merged.

Thanks,

A.

@Voriaz

Voriaz commented Feb 21, 2025

Copy link
Copy Markdown
Author

Hello,

Second wave of fixes. Sorry if I should have made a second PR, but GH puts my new commits in this PR too...

  • Issue#3: When exporting and re-importing devices, all fields were considered as modified even if the value was the same.
  • Issue#4: When importing devices, the hostname is checked against a regex. This prevent re-importing previously exported data that were created via the GUI which is not checking the hostname.
  • Issue#5: When importing a device with no type and no section, these fields are not mandatory, but they are checked against existing types and sections which fails and prevent importing.
  • Issue#6: A bug was introduced in my previous commit which was not removing the trailing ';' on device sections. This was causing imported devices to belong to a non existing "empty" section.

I'm proposing the following fixes:

  • Issue#3: I've fixed this.
  • Issue#4: To harmonize the process, I propose not to check device hostname on import like it's done when creating a device on GUI. Maybe it would have been better to introduce device hostname check in GUI too ? What do you think.
  • Issue#5: I've added a second check to not verify if "empty" section and type exists and allow device import in that case
  • Issue#6: I've fixed this.

Seems to fix the following Issues: #3887 #2103 #1894 #3463

Thanks,

A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant