Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import Local Linux Machine template #5127

Closed
paulgevers opened this issue Jan 3, 2023 · 4 comments
Closed

Unable to import Local Linux Machine template #5127

paulgevers opened this issue Jan 3, 2023 · 4 comments
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue

Comments

@paulgevers
Copy link
Contributor

Describe the bug

As part of the post installation of Cacti in the Debian packaging, the templates are installed with

        echo -n "Loading default cacti templates (may take some time)."
        su --shell /bin/sh www-data -c "/usr/share/cacti/cli/import_package.php \
            --filename=/usr/share/cacti/site/install/templates/Local_Linux_Machine.xml.gz" > /dev/null
        echo -n "."
        su --shell /bin/sh www-data -c "/usr/share/cacti/cli/import_package.php \
            --filename=/usr/share/cacti/site/install/templates/Generic_SNMP_Device.xml.gz" > /dev/null
        echo -n "."
        su --shell /bin/sh www-data -c "/usr/share/cacti/cli/import_package.php \
            --filename=/usr/share/cacti/site/install/templates/NetSNMP_Device.xml.gz" > /dev/null
        echo -n "."
        su --shell /bin/sh www-data -c "/usr/share/cacti/cli/import_package.php \
            --filename=/usr/share/cacti/site/install/templates/Cisco_Router.xml.gz" > /dev/null
        echo "  done."

While running the test suite, I noticed that installing cacti 1.2.23 fails with:

Loading default cacti templates (may take some time).PHP Warning:  Undefined array key "files" in /usr/share/cacti/site/lib/import.php on line 2455
PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/share/cacti/site/lib/import.php:2458
Stack trace:
#0 /usr/share/cacti/cli/import_package.php(153): import_display_results()
#1 {main}
  thrown in /usr/share/cacti/site/lib/import.php on line 2458

To Reproduce

Steps to reproduce the behavior:

  1. I would expect the same happens in a clean cacti environment running the import_package.php --filename=$path_to/Local_Linux_Machine.xml.gz command.

Expected behavior

import_package.php shouldn't raise an error.

Desktop (please complete the following information)

  • OS: Debian

  • Browser: NA

Additional context

Full post install script:
https://salsa.debian.org/cacti-team/cacti/-/blob/master/debian/cacti.postinst

@paulgevers paulgevers added bug Undesired behaviour unverified Some days we don't have a clue labels Jan 3, 2023
@paulgevers
Copy link
Contributor Author

I have to check (but not today), maybe it's not the first template that fails, but the second.

I just noticed there's a dot "." in the output, suggesting the first template loaded successfully. I have now changed my script to load all templates, and now it fails on the third, but retrying the second fails too.

@TheWitness
Copy link
Member

Thanks @paulgevers, I'm not sure how this slipped past. Let me see if I can figure it out and post the solution.

TheWitness added a commit that referenced this issue Jan 4, 2023
importing Local_Linux_Machine.xml.gz template raises PHP error
@TheWitness TheWitness added resolved A fixed issue confirmed Bug is confirm by dev team and removed unverified Some days we don't have a clue labels Jan 4, 2023
@TheWitness
Copy link
Member

All fixed @paulgevers. Thanks for reporting.

@paulgevers
Copy link
Contributor Author

Confirmed loading the templates work with these patches.

@netniV netniV closed this as completed Jan 4, 2023
TheWitness added a commit that referenced this issue Jan 5, 2023
Porting forward these three bugs and updating the CHANGELOG for #5127
@netniV netniV changed the title 1.2.23: importing Local_Linux_Machine.xml.gz template raises PHP error Unable to import Local Linux Machine template Feb 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants