Skip to content

Unable to import Local Linux Machine template #5127

@paulgevers

Description

@paulgevers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourconfirmedBug is confirm by dev teamresolvedA fixed issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions