cacti icon indicating copy to clipboard operation
cacti copied to clipboard

Move Cacti to using yml for templates import/export

Open TheWitness opened this issue 4 years ago • 7 comments

Feature Request

Currently, Cacti supports template management using XML files. Most modern frameworks have moved away from XML and presently use YAML as it's much more readable and easier to manage.

Propose Cacti being enhanced to Export to YAML by default and deprecating XML. XML would continue to be supported for some time to come.

TheWitness avatar Jan 04 '21 12:01 TheWitness

Seems like it would be easier to use json, as the encoder is already built in. If we want to use yaml, we have to write our own parser (or find one, which means another dependancy).

cigamit avatar Jan 13 '21 22:01 cigamit

PHP has partsers for YAML, They are named odly, not encode/decide.

TheWitness avatar Jan 14 '21 12:01 TheWitness

https://www.php.net/manual/en/function.yaml-parse.php https://www.php.net/manual/en/function.yaml-emit.php

There are also file based versions (_file on the end). I like json because if follows an array structure clearly, whereas yml is nice for readability but easier to misalign things (imho). So overall, not sure what the "best" method is as that is a personal preference. The installer, for example, uses json. Whatever we choose, we should be consistent so we don't break things down the line or cause confusion.

netniV avatar Jan 15 '21 13:01 netniV

Do you consider also including the scripts that belong to a template? That would be a real help, because then templates can be imported in one go without having to have additional permissions on the shell.

To avoid overwriting stuff, an option "don't overwrite existing files" could be added on import, or make cacti create the files with a name extension like ".imported-" or similar.

bernisys avatar Feb 22 '21 17:02 bernisys

We have a packaging plugin, but need more help on the team to get it released to the public.

TheWitness avatar Feb 23 '21 12:02 TheWitness

@TheWitness i know .. finding more skilled ppl to get on the train can be a pain. Maybe i can provide some help - not sure, as i'm not that much of a php guy, just poking around mostly. Dropped you a mail a while ago to your cacti address, did you see/read it?

bernisys avatar Mar 03 '21 11:03 bernisys

Saw it. Have not absorbed it. Responded earlier.

TheWitness avatar Mar 03 '21 12:03 TheWitness