UnixAgent icon indicating copy to clipboard operation
UnixAgent copied to clipboard

postinst.pl --configdir working but not aware of agent behaviour when looking for config files

Open kejones999 opened this issue 6 years ago • 0 comments

General informations

Operating system : Debian Stretch Perl version :5.24.1

OCS Inventory informations

Unix agent version : 2.4.1

Problem's description

I've been upgrading our systems to use 2.4.1 manually (because Debian stable still only has an old package) and am utterly enjoying the postinst.pl script but ran into a small conceptual issue. If you specify the --configdir parameter it works fine and creates the right files in the right place. Unfortunately though, it's not aware of the agent's behaviour when it's looking for its config files and doesn't remove configs from locations the agent will look for first. Effectively alternate paths/configs never get seen if they're lower down the pecking order of paths the agent looks in.

Given the coding in the script, might I suggest it makes more use of the ordering of the search path array (ie my @default_configdirs = "/etc/ocsinventory", "/usr/local/etc/ocsinventory", "/etc/ocsinventory-agent")?

Theoretically, when you match the --configdir to it, it should be fairly easy to work backwards from that point in the array and "move" higher priority config files down to the new location if needed. By taking advantage of clobbering you'd hopefully end up with a nicely migrated single config file where you expect it to be and simultaneously remove the configs the agent keeps finding (I hope!)

Sorry! That might need more explaining! - So I just edited this :-)

Regards,

Keith

Inventory log file ( optional )

Use github cloud or trusted upload website

kejones999 avatar Apr 10 '18 20:04 kejones999