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

Can't delete rack if patch panel exists; can't delete patch panels (SQL Error) #794

Open
listerr opened this issue Mar 29, 2022 · 2 comments

Comments

@listerr
Copy link
Contributor

listerr commented Mar 29, 2022

ISSUE TYPE

Bug Report

VERSION
define( 'APPLICATION_VERSION', '6.2.0' );
define( 'APPLICATION_VERDATE', '2021111400' );
ENVIRONMENT
PHP 8.0.14 (cli) (built: Dec 20 2021 21:22:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies

ii  libapache2-mod-php8.0          8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-common                     2:91+ubuntu20.04.1+deb.sury.org+1                                   all          Common files for PHP packages
ii  php-composer-ca-bundle         1.2.6-1                                                             all          utility library to find a path to the system CA bundle
ii  php-composer-semver            1.5.1-1                                                             all          utilities, version constraint parsing and validation
ii  php-composer-spdx-licenses     1.5.3-1                                                             all          SPDX licenses list and validation library
ii  php-composer-xdebug-handler    1.4.0-1                                                             all          Restarts a process without Xdebug
ii  php-json-schema                5.2.9-1                                                             all          implementation of JSON schema
ii  php-psr-container              1.0.0-2                                                             all          Common Container Interface (PHP FIG PSR-11)
ii  php-psr-log                    1.1.2-1                                                             all          common interface for logging libraries
ii  php-symfony-console            4.3.8+dfsg-1ubuntu1                                                 all          run tasks from the command line
ii  php-symfony-filesystem         4.3.8+dfsg-1ubuntu1                                                 all          basic filesystem utilities
ii  php-symfony-finder             4.3.8+dfsg-1ubuntu1                                                 all          find files and directories
ii  php-symfony-process            4.3.8+dfsg-1ubuntu1                                                 all          execute commands in sub-processes
ii  php-symfony-service-contracts  1.1.8-1                                                             all          Generic abstractions related to writing services
ii  php8.0                         8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.0-bcmath                  8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        Bcmath module for PHP
ii  php8.0-cgi                     8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        server-side, HTML-embedded scripting language (CGI binary)
ii  php8.0-cli                     8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        command-line interpreter for the PHP scripting language
ii  php8.0-common                  8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        documentation, examples and common module for PHP
ii  php8.0-curl                    8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        CURL module for PHP
ii  php8.0-ds                      1.4.0-1+ubuntu20.04.1+deb.sury.org+1                                amd64        PHP extension providing efficient data structures for PHP 7
ii  php8.0-fpm                     8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php8.0-gd                      8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        GD module for PHP
ii  php8.0-igbinary                3.2.6+2.0.8-2+ubuntu20.04.1+deb.sury.org+3                          amd64        igbinary PHP serializer
ii  php8.0-intl                    8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        Internationalisation module for PHP
ii  php8.0-mbstring                8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        MBSTRING module for PHP
ii  php8.0-memcache                8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-3+ubuntu20.04.1+deb.sury.org+3 amd64        memcache extension module for PHP
ii  php8.0-memcached               3.1.5+2.2.0-10+ubuntu20.04.1+deb.sury.org+3                         amd64        memcached extension module for PHP, uses libmemcached
ii  php8.0-msgpack                 2.2.0~rc1+2.1.2+0.5.7-2+ubuntu20.04.1+deb.sury.org+3                amd64        PHP extension for interfacing with MessagePack
ii  php8.0-mysql                   8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        MySQL module for PHP
ii  php8.0-opcache                 8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        Zend OpCache module for PHP
ii  php8.0-readline                8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        readline module for PHP
ii  php8.0-rrd                     2.0.3+1.1.3-2+ubuntu20.04.1+deb.sury.org+3                          amd64        PHP bindings to rrd tool system
ii  php8.0-snmp                    8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        SNMP module for PHP
ii  php8.0-xml                     8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php8.0-yaml                    2.2.2+2.1.0+2.0.4+1.3.2-1+ubuntu20.04.1+deb.sury.org+3              amd64        YAML-1.1 parser and emitter for PHP
ii  php8.0-zip                     8.0.14-1+ubuntu20.04.1+deb.sury.org+1                               amd64        Zip module for PHP

CONFIGURATION
APP_DEBUG=false
APP_URL="https://portal.lonap.net"
APP_TIMEZONE="Europe/London"
APP_LOG="single"
APP_LOG_LEVEL=debug
IXP_MULTIIXP_ENABLED=false
IXP_RESELLER_ENABLED=true
IXP_RESELLER_RESOLD_BILLING=false
IXP_AS112_UI_ACTIVE=false
IXP_FE_LAYER2_ADDRESSES_CUST_CAN_EDIT=true
IXP_FE_LAYER2_ADDRESSES_EMAIL_ON_CHANGE_DEST="${IDENTITY_SUPPORT_EMAIL}"
IXP_FE_LAYER2_ADDRESSES_EMAIL_ON_CUSTOMER_CHANGE=true
IXP_FE_FRONTEND_DISABLED_LOGO=false
IXP_FE_CUSTOMER_BILLING_UPDATES_NOTIFY="XXXX@lonap.net"
IXP_FE_FRONTEND_DISABLED_RS_PREFIXES=true
IXP_FE_FRONTEND_DISABLED_NETINFO=true
IXP_FE_FRONTEND_DISABLED_CUSTKIT=true
IXP_FE_FRONTEND_DISABLED_CONSOLE=true
IXP_FE_FRONTEND_DISABLED_LOGO=false
IXP_FE_FRONTEND_DISABLED_LOOKING_GLASS=false
IXP_FE_FRONTEND_DISABLED_FILTERED_PREFIXES=false
IXP_FE_BETA_CORE_BUNDLES=true
IXP_FE_VLANINTERFACES_HOSTNAME_REQUIRED=false
GRAPHER_BACKENDS="mrtg|sflow"
GRAPHER_CACHE_ENABLED=true
GRAPHER_BACKEND_MRTG_DBTYPE="log"
GRAPHER_BACKEND_MRTG_WORKDIR="/srv/mrtg"
GRAPHER_BACKEND_MRTG_LOGDIR="http://mrtg.lonap.net/mrtg"
GRAPHER_BACKEND_SFLOW_ENABLED=true
GRAPHER_BACKEND_SFLOW_ROOT="http://sflow-old.lonap.net/grapher-sflow"
GRAPHER_BACKEND_SMOKEPING_ENABLED=false
IXP_API_JSONEXPORTSCHEMA_PUBLIC=true
VIEW_SKIN="lonap"
VIEW_SMARTY_SKIN="lonap"
CACHE_DRIVER=memcached
DOCTRINE_PROXY_AUTOGENERATE=false
DOCTRINE_CACHE=array
DOCTRINE_CACHE_NAMESPACE=IXPMANAGERNAMESPACE
IXP_API_RIR_EMAIL_TO=xxxxx@ripe.net
IXP_API_RIR_EMAIL_FROM=xxxxx@lonap.net
IXP_IRRDB_BGPQ3_PATH=/usr/bin/bgpq3
IXP_IRRDB_MIN_V4_SUBNET_SIZE=24
IXP_IRRDB_MIN_V6_SUBNET_SIZE=48
IXP_RPKI_RTR1_HOST=5.57.xx.xx
IXP_RPKI_RTR1_PORT=3323
IXP_RPKI_RTR2_HOST=5.57.xx.xx
IXP_RPKI_RTR2_PORT=3323
AUTH_PEERINGDB_ENABLED=true
PEERINGDB_OAUTH_CLIENT_ID="XXXXX"
PEERINGDB_OAUTH_CLIENT_SECRET="XXXXX"
PEERINGDB_OAUTH_REDIRECT="https://portal.lonap.net/auth/login/peeringdb/callback"
AUTH_PEERINGDB_PRIVS=2
AUTH_ZF1_PWHASH="bcrypt"
SESSION_DRIVER=file
IXP_NO_TRANSIT_ASNS_EXCLUDE=6461

SUMMARY

When deleting a rack, the following 500 Error occurs:

500
Server Error :: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`ixpmanager`.`patch_panel`, CONSTRAINT `FK_79A52562D351EC` FOREIGN KEY (`cabinet_id`) REFERENCES `cabinet` (`id`)) (SQL: delete from `cabinet` where `id` = 4)

This would appear to be because there are patch panels assigned to the rack.

If you "delete" the patch panels, it only marks them as inactive but does not delete it from the database.

Workaround: Move the panels to another rack to delete the rack. But then can't delete the patch panel.
Has to be manually deleted in the database.

STEPS TO REPRODUCE

Delete a rack with patch panel assigned.

EXPECTED RESULTS

Rack gone.

ACTUAL RESULTS

Error. Rack not gone!

@listerr listerr changed the title Can't delete rack if patch panel ports exist; can't delete patch panels (SQL Error) Can't delete rack if patch exists; can't delete patch panels (SQL Error) Mar 29, 2022
@listerr listerr changed the title Can't delete rack if patch exists; can't delete patch panels (SQL Error) Can't delete rack if patch panel exists; can't delete patch panels (SQL Error) Mar 29, 2022
@listerr
Copy link
Contributor Author

listerr commented Mar 29, 2022

Delete a rack:

Patch panel id's 76 - 81 are in the rack to be deleted.
Rack id to be deleted = 4.

UPDATE patch_panel_port SET switch_port_id   = NULL WHERE patch_panel_id BETWEEN 76 AND 81;
UPDATE patch_panel_port SET duplex_master_id = NULL WHERE patch_panel_id BETWEEN 76 AND 81;
UPDATE patch_panel_port_history SET duplex_master_id = NULL WHERE patch_panel_port_id IN (SELECT id FROM patch_panel_port WHERE patch_panel_id BETWEEN 76 AND 81);
DELETE FROM patch_panel_port_history WHERE patch_panel_port_id IN (SELECT id FROM patch_panel_port WHERE patch_panel_id BETWEEN 76 AND 81);
DELETE FROM patch_panel_port WHERE patch_panel_id BETWEEN 76 AND 81;
DELETE FROM patch_panel WHERE id BETWEEN 76 AND 81;

DELETE FROM cabinet WHERE id = 4;

@listerr
Copy link
Contributor Author

listerr commented Nov 9, 2022

Partially addressed in 5ec406e

  • The SQL error no longer occurs. However still no way to delete patch panels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant