Skip to content

Automation references the wrong table name causing errors #5315

Closed

Description

@bernisys

Describe the bug

When setting a "monthly" or "monthly on day" schedule for a network scan automation, you will get SQL errors in the logs, telling that the "analytics_report_templates" table does not exist.

Indeed it is referenced only on that particular place in the code, i found it nowhere else.
Probably a relic from the past? - might be, so the lines can probably be removed.

Here's the code that causes the error, starting around line 3899 in lib/api_automation.php:

                db_execute_prepared('UPDATE analytics_report_templates
			SET next_start = ?
			WHERE id = ?',
				array(date('Y-m-d H:i', $next), $network_id));

We're on cacti 1.2.23, code part is still present in 24 and wasn't touched for a long time.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Automation -> Networks
  2. Create any discovery with a schedule of "Monthly" or "Monthly on Day"
  3. activate it
  4. check logs for: "CMDPHP ERROR: A DB Exec Failed!, Error: Table 'cacti.analytics_report_templates' doesn't exist"

Expected behavior

Obviously, errors should not appear. ;)

Activity

  1. added
    bugUndesired behaviour
    unverifiedSome days we don't have a clue
    on Apr 27, 2023
  2. TheWitness commented on Apr 27, 2023

    @TheWitness
    Member

    Thanks for reporting this. I'll be working on the 1.2.x branch a little this weekend.

  3. changed the title [-]automation library references "ghost" Table: analytics_report_templates[/-] [+]automation library references "ghost" Table[/+] on Apr 29, 2023
  4. added a commit that references this issue on Apr 29, 2023
  5. added
    automationAutomation related issue
    confirmedBug is confirm by dev team
    and removed
    unverifiedSome days we don't have a clue
    on Apr 29, 2023
  6. added this to the v1.2.25 milestone on Apr 29, 2023
  7. TheWitness commented on Apr 29, 2023

    @TheWitness
    Member

    Fixed.

  8. added a commit that references this issue on Apr 29, 2023
  9. changed the title [-]automation library references "ghost" Table[/-] [+]Automation references the wrong table name causing errors[/+] on Sep 3, 2023
  10. locked and limited conversation to collaborators on Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationAutomation related issuebugUndesired behaviourconfirmedBug is confirm by dev teamporting requiredRequires porting to developresolvedA fixed issuestatus:confirmedNamespaced Cacti workflow labeltype:bugNamespaced Cacti workflow label

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions