installing V6 update broke dnl_api_core.service

31 views
Skip to first unread message

Justin Hannah

unread,
Jun 16, 2023, 1:15:04 AM6/16/23
to dnl-class4-user
yum updating the V6 rocky linux 8 rpm's broke the dnl_api_core.service.

I did the update because I was unable to do anything with termination or origination clients or vendors anymore.  Got errors about a missing resource.block_dnc in the UI-  "ProgrammingError: (psycopg2.errors.UndefinedColumn) column resource.block_dno does not exist"


[root@sw api_dnl]# systemctl status dnl_api_core.service
● dnl_api_core.service - dnl api web service daemon
   Loaded: loaded (/etc/systemd/system/dnl_api_core.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2023-06-16 00:07:40 CDT; 3min 5s ago
  Process: 3350 ExecStart=/usr/bin/api_dnl_run (code=exited, status=1/FAILURE)
 Main PID: 3350 (code=exited, status=1/FAILURE)

Jun 16 00:07:40 sw.com systemd[1]: dnl_api_core.service: Service RestartSec=100ms expired, scheduling restart.
Jun 16 00:07:40 sw.com systemd[1]: dnl_api_core.service: Scheduled restart job, restart counter is at 5.
Jun 16 00:07:40 sw.com systemd[1]: Stopped dnl api web service daemon.
Jun 16 00:07:40 sw.com systemd[1]: dnl_api_core.service: Start request repeated too quickly.
Jun 16 00:07:40 sw.com systemd[1]: dnl_api_core.service: Failed with result 'exit-code'.
Jun 16 00:07:40 sw.com systemd[1]: Failed to start dnl api web service daemon.


I tried to manually start the api_dnl_run command from the directory that the init script does it- and get this python error.  So I think this is the issue that needs to be fixed:


[root@sw api_dnl]# pwd
/opt/denovo_v6/api_dnl
[root@sw api_dnl]# /usr/bin/api_dnl_run
Traceback (most recent call last):
  File "/usr/bin/api_dnl_run", line 33, in <module>
    sys.exit(load_entry_point('api-dnl==2.5.24', 'console_scripts', 'api_dnl_run')())
  File "/usr/bin/api_dnl_run", line 25, in importlib_load_entry_point
    return next(matches).load()
StopIteration
[root@sw api_dnl]#






Meanwhile. this is from the api daemon log file, about all the database issues with the resource.block_dnc ... Maybe after we get my api to start back up again then you can tell me how to add the database column to the right table so it starts working again.


[root@sw api_dnl]# pwd
/opt/denovo_v6/api_dnl
[root@sw api_dnl]# tail -100 dnl.log
       
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/api_dnl/resources.py", line 545, in _on_get
    objects_list, total, page, per_page, fields = self.get_objects_list(req, self.model_class, **kwargs)
  File "/usr/lib/python3.6/site-packages/api_dnl/resources.py", line 776, in get_objects_list
    query_only = 'query_only' in kwargs
  File "/usr/lib/python3.6/site-packages/api_dnl/base_model.py", line 158, in get_objects_list
    return qs.all(), cnt
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2703, in all
    return list(self)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column resource.block_dno does not exist
LINE 35: ...ntry_whitelist AS resource_ani_country_whitelist, resource.b...
                                                              ^
HINT:  Perhaps you meant to reference the column "resource.block_dnc".
 [SQL: 'SELECT (SELECT client.name \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_1, (SELECT client.client_type \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_2, (SELECT client.mode \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_3, (SELECT client.status \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_4, (SELECT client.allowed_credit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_5, (SELECT client.call_limit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_6, (SELECT client.cps_limit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_7, (SELECT coalesce(client.rate_email, client.email) AS coalesce_1 \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_8, (SELECT client.email \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_9, (SELECT client.name \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_10, (SELECT (SELECT users.is_online = %(is_online_1)s AS anon_13 \nFROM users \nWHERE users.user_id = client.user_id) AS anon_12 \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_11, (SELECT client.status \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_14, (SELECT rate_table.name \nFROM rate_table \nWHERE rate_table.rate_table_id = resource.rate_table_id) AS anon_15, (SELECT count(dynamic_route_items.id) AS count_1 \nFROM dynamic_route_items \nWHERE dynamic_route_items.resource_id = resource.resource_id) AS anon_16, (SELECT count(DISTINCT product.product_id) AS count_2 \nFROM product, product_items_resource, product_items \nWHERE product_items_resource.resource_id = resource.resource_id AND product_items.product_id = product.product_id AND product_items_resource.item_id = product_items.item_id AND product_items.product_id IS NOT NULL) AS anon_17, (SELECT random_ani_group.group_name \nFROM random_ani_group \nWHERE random_ani_group.id = resource.random_table_id) AS anon_18, resource.resource_id AS resource_resource_id, resource.name AS resource_name, resource.ingress AS resource_ingress, resource.egress AS resource_egress, resource.active AS resource_active, resource.account_id AS resource_account_id, resource.agent_type AS resource_agent_type, resource.alias AS resource_alias, resource.amount_per_port AS resource_amount_per_port, resource.ani_cap_limit AS resource_ani_cap_limit, resource.ani_cps_limit AS resource_ani_cps_limit, resource.auth_type AS resource_auth_type, resource.bill_by AS resource_bill_by, resource.billing_method AS resource_billing_method, resource.billing_port_type AS resource_billing_port_type, resource.billing_rule AS resource_billing_rule, resource.billing_type AS resource_billing_type, resource.block_404_number_time AS resource_block_404_number_time, resource.block_time AS resource_block_time, resource.canada_other AS resource_canada_other, resource.canada_route AS resource_canada_route, resource.capacity AS resource_capacity, resource.cli_type AS resource_cli_type, resource.client_id AS resource_client_id, resource.cost_per_port AS resource_cost_per_port, resource.counter_time AS resource_counter_time, resource.cps_limit AS resource_cps_limit, resource.create_time AS resource_create_time, resource.delay_bye_limit AS resource_delay_bye_limit, resource.delay_bye_second AS resource_delay_bye_second, resource.disable_by_alert AS resource_disable_by_alert, resource.display_name AS resource_display_name, resource.div AS resource_div, resource.dnis_cap_limit AS resource_dnis_cap_limit, resource.dnis_cps_limit AS resource_dnis_cps_limit, resource.dnis_only AS resource_dnis_only, resource.dtmf_detect AS resource_dtmf_detect, resource.dtmf_type AS resource_dtmf_type, resource.dummy_trunk AS resource_dummy_trunk, resource.egress_bill_after_action AS resource_egress_bill_after_action, resource.enfource_cid AS resource_enfource_cid, resource.enough_balance AS resource_enough_balance, resource.group_id AS resource_group_id, resource.ignore_early_media AS resource_ignore_early_media, resource.ignore_early_nosdp AS resource_ignore_early_nosdp, resource.ignore_ring AS resource_ignore_ring, resource.inband AS resource_inband, resource.info AS resource_info, resource.intl_route AS resource_intl_route, resource.is_del AS resource_is_del, resource.is_virtual AS resource_is_virtual, resource.jurisdiction_use_dnis AS resource_jurisdiction_use_dnis, resource.last_priority AS resource_last_priority, resource.lnp AS resource_lnp, resource.lnp_dipping AS resource_lnp_dipping, resource.lnp_dipping_rate AS resource_lnp_dipping_rate, resource.lrn_block AS resource_lrn_block, resource.lrn_prefix AS resource_lrn_prefix, resource.marketplace AS resource_marketplace, resource.max_duration AS resource_max_duration, resource.media_timeout AS resource_media_timeout, resource.media_type AS resource_media_type, resource.number AS resource_number, resource.oli AS resource_oli, resource.paid AS resource_paid, resource.pass_response_code AS resource_pass_response_code, resource.pass_through AS resource_pass_through, resource.pci AS resource_pci, resource.price_per_actual_channel AS resource_price_per_actual_channel, resource.price_per_max_channel AS resource_price_per_max_channel, resource.priority AS resource_priority, resource.priv AS resource_priv, resource.private AS resource_private, resource.product_id AS resource_product_id, resource.profit_margin AS resource_profit_margin, resource.profit_type AS resource_profit_type, resource.proto AS resource_proto, resource.purged AS resource_purged, resource.random_table_id AS resource_random_table_id, resource.rate_decimal AS resource_rate_decimal, resource.rate_rounding AS resource_rate_rounding, resource.rate_table_id AS resource_rate_table_id, resource.rate_use_rpid AS resource_rate_use_rpid, resource.rating_type AS resource_rating_type, resource.re_invite AS resource_re_invite, resource.re_invite_interval AS resource_re_invite_interval, resource.redirect AS resource_redirect, resource.res_strategy AS resource_res_strategy, resource.resource_block_group_id AS resource_resource_block_group_id, resource.resource_template_id AS resource_resource_template_id, resource.rfc2833 AS resource_rfc2833, resource.rfc_2833 AS resource_rfc_2833, resource.rfc_r833_payload AS resource_rfc_r833_payload, resource.ring_timeout AS resource_ring_timeout, resource.route_strategy_id AS resource_route_strategy_id, resource.rpid AS resource_rpid, resource.rpid_id_type AS resource_rpid_id_type, resource.rpid_party AS resource_rpid_party, resource.rpid_privacy AS resource_rpid_privacy, resource.rpid_screen AS resource_rpid_screen, resource.service_type AS resource_service_type, resource.shaken_sign_policy AS resource_shaken_sign_policy, resource.shaken_vfy_policy AS resource_shaken_vfy_policy, resource.shaken_allow_resign AS resource_shaken_allow_resign, resource.shaken_ani_group_list_id AS resource_shaken_ani_group_list_id, resource.shaken_default_attest_lvl AS resource_shaken_default_attest_lvl, resource.shaken_p_headers AS resource_shaken_p_headers, resource.status AS resource_status, resource.switch_profile_id AS resource_switch_profile_id, resource.t38 AS resource_t38, resource.tdm AS resource_tdm, resource.transaction_fee_id AS resource_transaction_fee_id, resource.transnexus AS resource_transnexus, resource.trunk_type AS resource_trunk_type, resource.trunk_type2 AS resource_trunk_type2, resource.update_at AS resource_update_at, resource.update_by AS resource_update_by, resource.update_time AS resource_update_time, resource.us_other AS resource_us_other, resource.us_route AS resource_us_route, resource.vfy_policy AS resource_vfy_policy, resource.wait_ringtime180 AS resource_wait_ringtime180, resource.ym_fraud_prob AS resource_ym_fraud_prob, resource.ym_spam_score AS resource_ym_spam_score, resource.ym_tcpa_prob AS resource_ym_tcpa_prob, resource.rate_profile AS resource_rate_profile, resource.priv_value AS resource_priv_value, resource.use_sip404_ani AS resource_use_sip404_ani, resource.old_detail_table AS resource_old_detail_table, resource.max_failover_route_count AS resource_max_failover_route_count, resource.block_dnc AS resource_block_dnc, resource.block_wireless AS resource_block_wireless, resource.block_wireless_ani AS resource_block_wireless_ani, resource.block_toll_free_ani AS resource_block_toll_free_ani, resource.invalid_ani_action AS resource_invalid_ani_action, resource.ani_country_whitelist AS resource_ani_country_whitelist, resource.block_dno AS resource_block_dno, (SELECT count(resource_ip.resource_ip_id) AS count_3 \nFROM resource_ip \nWHERE resource.resource_id = resource_ip.resource_id AND resource_ip.reg_type = %(reg_type_1)s) AS anon_19, (SELECT string_agg(CAST(resource_prefix.route_strategy_id AS VARCHAR), %(string_agg_2)s) AS string_agg_1 \nFROM resource_prefix \nWHERE resource_prefix.resource_id = resource.resource_id GROUP BY resource_prefix.resource_id \n LIMIT %(param_1)s) AS anon_20, (SELECT resource_prefix.tech_prefix \nFROM resource_prefix \nWHERE resource_prefix.resource_id = resource.resource_id AND resource_prefix.resource_id IS NOT NULL ORDER BY resource_prefix.id \n LIMIT %(param_2)s) AS anon_21, (SELECT rate_send_log_detail.sent_on \nFROM rate_send_log_detail \nWHERE resource.resource_id = rate_send_log_detail.resource_id ORDER BY rate_send_log_detail.sent_on DESC \n LIMIT %(param_3)s) AS anon_22 \nFROM resource \nWHERE resource.ingress = true AND resource.purged = false AND resource.alias != %(alias_1)s AND (resource.name IS NULL OR resource.name NOT LIKE %(name_1)s) AND resource.trunk_type2 = %(trunk_type2_1)s AND resource.ingress = %(ingress_1)s AND resource.ingress IN (%(ingress_2)s) \n LIMIT %(param_4)s OFFSET %(param_5)s'] [parameters: {'is_online_1': 1, 'reg_type_1': 0, 'string_agg_2': ',', 'param_1': 1, 'param_2': 1, 'param_3': 1, 'alias_1': '', 'name_1': '#%', 'trunk_type2_1': 0, 'ingress_1': 'true', 'ingress_2': True, 'param_4': 999, 'param_5': 0}]
' at resources.py: 578
2023-06-15 23:48:14,130 [DEBUG] 'Responding with 406 Not Acceptable: {"success": false, "error": {"message": "(psycopg2.errors.UndefinedColumn) column resource.block_dno does not exist\nLINE 35: ...ntry_whitelist AS resource_ani_country_whitelist, resource.b...", "code": 406, "reason": "ProgrammingError"}, "error_type": "operation_error"}' at middleware.py: 96
2023-06-15 23:48:14,150 [DEBUG] 'CORS headers not send: no ORIGIN' at user.py: 21
2023-06-15 23:48:14,150 [DEBUG] 'GET /api_dnl/v1/trunk/egress/list from Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 (127.0.0.1), data: per_page=999&trunk_type2=Termination%20Traffic' at middleware.py: 69
2023-06-15 23:48:14,161 [DEBUG] 'DB [default] saving object: <User: user_id = 1, name = justin, password = $2a$12$yLlDmkJ9keEPYYqwBhWpYOM6TudpQiPVq2AOVCMEXRKFE7dk/7S2u, role_id = 0, reseller_id = None, create_time = 2023-02-16 02:31:20.364143-06:00, active = True, client_id = None, email = None, first_name = None, last_name = None, user_type = admin, create_user_id = 1, last_login_time = 2023-06-15 23:44:47.149622-05:00, card_id = None, is_online = 1, login_ip = 76.228.206.147, default_mod = , default_mod2 = , last_seen = 2023-06-15 23:48:14.158465-05:00, report_group = True, outbound_report = True, all_termination = True, show_carrier_trunk_drop_only = False, report_fields = None, landing_page = /statistics/dashboard, cdr_api_token = None, cdr_expire = None, avatar_id = None>' at db_class.py: 20
2023-06-15 23:48:14,162 [DEBUG] 'on_process_resource_end SUCCESS' at user.py: 76
2023-06-15 23:48:14,178 [DEBUG] 'req.headers['ACCEPT']=application/json, text/plain, */*' at resources.py: 540
2023-06-15 23:48:14,203 [ERROR] 'Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column resource.block_dno does not exist
LINE 35: ...ntry_whitelist AS resource_ani_country_whitelist, resource.b...
                                                              ^
HINT:  Perhaps you meant to reference the column "resource.block_dnc".


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/api_dnl/resources.py", line 545, in _on_get
    objects_list, total, page, per_page, fields = self.get_objects_list(req, self.model_class, **kwargs)
  File "/usr/lib/python3.6/site-packages/api_dnl/resources.py", line 776, in get_objects_list
    query_only = 'query_only' in kwargs
  File "/usr/lib/python3.6/site-packages/api_dnl/base_model.py", line 158, in get_objects_list
    return qs.all(), cnt
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2703, in all
    return list(self)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column resource.block_dno does not exist
LINE 35: ...ntry_whitelist AS resource_ani_country_whitelist, resource.b...
                                                              ^
HINT:  Perhaps you meant to reference the column "resource.block_dnc".
 [SQL: 'SELECT (SELECT client.name \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_1, (SELECT client.client_type \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_2, (SELECT client.mode \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_3, (SELECT client.status \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_4, (SELECT client.allowed_credit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_5, (SELECT client.call_limit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_6, (SELECT client.cps_limit \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_7, (SELECT coalesce(client.rate_email, client.email) AS coalesce_1 \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_8, (SELECT client.email \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_9, (SELECT client.name \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_10, (SELECT (SELECT users.is_online = %(is_online_1)s AS anon_13 \nFROM users \nWHERE users.user_id = client.user_id) AS anon_12 \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_11, (SELECT client.status \nFROM client \nWHERE client.client_id = resource.client_id) AS anon_14, (SELECT rate_table.name \nFROM rate_table \nWHERE rate_table.rate_table_id = resource.rate_table_id) AS anon_15, (SELECT count(dynamic_route_items.id) AS count_1 \nFROM dynamic_route_items \nWHERE dynamic_route_items.resource_id = resource.resource_id) AS anon_16, (SELECT count(DISTINCT product.product_id) AS count_2 \nFROM product, product_items_resource, product_items \nWHERE product_items_resource.resource_id = resource.resource_id AND product_items.product_id = product.product_id AND product_items_resource.item_id = product_items.item_id AND product_items.product_id IS NOT NULL) AS anon_17, (SELECT random_ani_group.group_name \nFROM random_ani_group \nWHERE random_ani_group.id = resource.random_table_id) AS anon_18, resource.resource_id AS resource_resource_id, resource.name AS resource_name, resource.ingress AS resource_ingress, resource.egress AS resource_egress, resource.active AS resource_active, resource.account_id AS resource_account_id, resource.agent_type AS resource_agent_type, resource.alias AS resource_alias, resource.amount_per_port AS resource_amount_per_port, resource.ani_cap_limit AS resource_ani_cap_limit, resource.ani_cps_limit AS resource_ani_cps_limit, resource.auth_type AS resource_auth_type, resource.bill_by AS resource_bill_by, resource.billing_method AS resource_billing_method, resource.billing_port_type AS resource_billing_port_type, resource.billing_rule AS resource_billing_rule, resource.billing_type AS resource_billing_type, resource.block_404_number_time AS resource_block_404_number_time, resource.block_time AS resource_block_time, resource.canada_other AS resource_canada_other, resource.canada_route AS resource_canada_route, resource.capacity AS resource_capacity, resource.cli_type AS resource_cli_type, resource.client_id AS resource_client_id, resource.cost_per_port AS resource_cost_per_port, resource.counter_time AS resource_counter_time, resource.cps_limit AS resource_cps_limit, resource.create_time AS resource_create_time, resource.delay_bye_limit AS resource_delay_bye_limit, resource.delay_bye_second AS resource_delay_bye_second, resource.disable_by_alert AS resource_disable_by_alert, resource.display_name AS resource_display_name, resource.div AS resource_div, resource.dnis_cap_limit AS resource_dnis_cap_limit, resource.dnis_cps_limit AS resource_dnis_cps_limit, resource.dnis_only AS resource_dnis_only, resource.dtmf_detect AS resource_dtmf_detect, resource.dtmf_type AS resource_dtmf_type, resource.dummy_trunk AS resource_dummy_trunk, resource.egress_bill_after_action AS resource_egress_bill_after_action, resource.enfource_cid AS resource_enfource_cid, resource.enough_balance AS resource_enough_balance, resource.group_id AS resource_group_id, resource.ignore_early_media AS resource_ignore_early_media, resource.ignore_early_nosdp AS resource_ignore_early_nosdp, resource.ignore_ring AS resource_ignore_ring, resource.inband AS resource_inband, resource.info AS resource_info, resource.intl_route AS resource_intl_route, resource.is_del AS resource_is_del, resource.is_virtual AS resource_is_virtual, resource.jurisdiction_use_dnis AS resource_jurisdiction_use_dnis, resource.last_priority AS resource_last_priority, resource.lnp AS resource_lnp, resource.lnp_dipping AS resource_lnp_dipping, resource.lnp_dipping_rate AS resource_lnp_dipping_rate, resource.lrn_block AS resource_lrn_block, resource.lrn_prefix AS resource_lrn_prefix, resource.marketplace AS resource_marketplace, resource.max_duration AS resource_max_duration, resource.media_timeout AS resource_media_timeout, resource.media_type AS resource_media_type, resource.number AS resource_number, resource.oli AS resource_oli, resource.paid AS resource_paid, resource.pass_response_code AS resource_pass_response_code, resource.pass_through AS resource_pass_through, resource.pci AS resource_pci, resource.price_per_actual_channel AS resource_price_per_actual_channel, resource.price_per_max_channel AS resource_price_per_max_channel, resource.priority AS resource_priority, resource.priv AS resource_priv, resource.private AS resource_private, resource.product_id AS resource_product_id, resource.profit_margin AS resource_profit_margin, resource.profit_type AS resource_profit_type, resource.proto AS resource_proto, resource.purged AS resource_purged, resource.random_table_id AS resource_random_table_id, resource.rate_decimal AS resource_rate_decimal, resource.rate_rounding AS resource_rate_rounding, resource.rate_table_id AS resource_rate_table_id, resource.rate_use_rpid AS resource_rate_use_rpid, resource.rating_type AS resource_rating_type, resource.re_invite AS resource_re_invite, resource.re_invite_interval AS resource_re_invite_interval, resource.redirect AS resource_redirect, resource.res_strategy AS resource_res_strategy, resource.resource_block_group_id AS resource_resource_block_group_id, resource.resource_template_id AS resource_resource_template_id, resource.rfc2833 AS resource_rfc2833, resource.rfc_2833 AS resource_rfc_2833, resource.rfc_r833_payload AS resource_rfc_r833_payload, resource.ring_timeout AS resource_ring_timeout, resource.route_strategy_id AS resource_route_strategy_id, resource.rpid AS resource_rpid, resource.rpid_id_type AS resource_rpid_id_type, resource.rpid_party AS resource_rpid_party, resource.rpid_privacy AS resource_rpid_privacy, resource.rpid_screen AS resource_rpid_screen, resource.service_type AS resource_service_type, resource.shaken_sign_policy AS resource_shaken_sign_policy, resource.shaken_vfy_policy AS resource_shaken_vfy_policy, resource.shaken_allow_resign AS resource_shaken_allow_resign, resource.shaken_ani_group_list_id AS resource_shaken_ani_group_list_id, resource.shaken_default_attest_lvl AS resource_shaken_default_attest_lvl, resource.shaken_p_headers AS resource_shaken_p_headers, resource.status AS resource_status, resource.switch_profile_id AS resource_switch_profile_id, resource.t38 AS resource_t38, resource.tdm AS resource_tdm, resource.transaction_fee_id AS resource_transaction_fee_id, resource.transnexus AS resource_transnexus, resource.trunk_type AS resource_trunk_type, resource.trunk_type2 AS resource_trunk_type2, resource.update_at AS resource_update_at, resource.update_by AS resource_update_by, resource.update_time AS resource_update_time, resource.us_other AS resource_us_other, resource.us_route AS resource_us_route, resource.vfy_policy AS resource_vfy_policy, resource.wait_ringtime180 AS resource_wait_ringtime180, resource.ym_fraud_prob AS resource_ym_fraud_prob, resource.ym_spam_score AS resource_ym_spam_score, resource.ym_tcpa_prob AS resource_ym_tcpa_prob, resource.rate_profile AS resource_rate_profile, resource.priv_value AS resource_priv_value, resource.use_sip404_ani AS resource_use_sip404_ani, resource.old_detail_table AS resource_old_detail_table, resource.max_failover_route_count AS resource_max_failover_route_count, resource.block_dnc AS resource_block_dnc, resource.block_wireless AS resource_block_wireless, resource.block_wireless_ani AS resource_block_wireless_ani, resource.block_toll_free_ani AS resource_block_toll_free_ani, resource.invalid_ani_action AS resource_invalid_ani_action, resource.ani_country_whitelist AS resource_ani_country_whitelist, resource.block_dno AS resource_block_dno, (SELECT count(resource_ip.resource_ip_id) AS count_3 \nFROM resource_ip \nWHERE resource.resource_id = resource_ip.resource_id AND resource_ip.reg_type = %(reg_type_1)s) AS anon_19, (SELECT string_agg(CAST(resource_prefix.route_strategy_id AS VARCHAR), %(string_agg_2)s) AS string_agg_1 \nFROM resource_prefix \nWHERE resource_prefix.resource_id = resource.resource_id GROUP BY resource_prefix.resource_id \n LIMIT %(param_1)s) AS anon_20, (SELECT resource_prefix.tech_prefix \nFROM resource_prefix \nWHERE resource_prefix.resource_id = resource.resource_id AND resource_prefix.resource_id IS NOT NULL ORDER BY resource_prefix.id \n LIMIT %(param_2)s) AS anon_21, (SELECT rate_send_log_detail.sent_on \nFROM rate_send_log_detail \nWHERE resource.resource_id = rate_send_log_detail.resource_id ORDER BY rate_send_log_detail.sent_on DESC \n LIMIT %(param_3)s) AS anon_22 \nFROM resource, users \nWHERE resource.egress = true AND resource.alias != %(alias_1)s AND resource.purged = false AND (users.user_id = %(user_id_1)s AND users.user_type = %(user_type_1)s OR users.user_id = %(user_id_2)s AND users.user_type = %(user_type_2)s AND resource.client_id = users.client_id OR resource.client_id IN (SELECT users_limit.client_id \nFROM users_limit \nWHERE users.user_id = %(user_id_3)s AND users.user_type = %(user_type_3)s AND users.user_id = users_limit.user_id) OR resource.client_id IN (SELECT agent_clients.client_id \nFROM agent_clients, agent \nWHERE users.user_id = %(user_id_4)s AND users.user_type = %(user_type_4)s AND users.user_id = agent.user_id AND agent.agent_id = agent_clients.agent_id)) AND (resource.name IS NULL OR resource.name NOT LIKE %(name_1)s) AND resource.trunk_type2 = %(trunk_type2_1)s AND resource.egress = %(egress_1)s AND resource.ingress IN (%(ingress_1)s) \n LIMIT %(param_4)s OFFSET %(param_5)s'] [parameters: {'is_online_1': 1, 'reg_type_1': 0, 'string_agg_2': ',', 'param_1': 1, 'param_2': 1, 'param_3': 1, 'alias_1': '', 'user_id_1': 1, 'user_type_1': 0, 'user_id_2': 1, 'user_type_2': 1, 'user_id_3': 1, 'user_type_3': 1, 'user_id_4': 1, 'user_type_4': 2, 'name_1': '#%', 'trunk_type2_1': 0, 'egress_1': 'true', 'ingress_1': False, 'param_4': 999, 'param_5': 0}]
' at resources.py: 578
2023-06-15 23:48:14,204 [DEBUG] 'Responding with 406 Not Acceptable: {"success": false, "error": {"message": "(psycopg2.errors.UndefinedColumn) column resource.block_dno does not exist\nLINE 35: ...ntry_whitelist AS resource_ani_country_whitelist, resource.b...", "code": 406, "reason": "ProgrammingError"}, "error_type": "operation_error"}' at middleware.py: 96
[root@sw api_dnl]#

Anne Kwong

unread,
Jun 16, 2023, 1:16:51 AM6/16/23
to Justin Hannah, dnl-class4-user
Hi Justin

Thanks alot for the detailed reporting of this issue.

We get on to fix it and will report here.

Thanks,
Anne
> --
> Useful Links:
> Get Help - http://support.denovolab.com
> Tutorial - http://cookbook.denovolab.com
> Video Training - https://www.youtube.com/channel/UCIVrN4OSdY-r4l_FA4ekIBA
> User Manual - http://doc.denovolab.com
> ---
> You received this message because you are subscribed to the Google Groups "dnl-class4-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dnl-class4-us...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dnl-class4-user/58078100-afef-42ef-b5ea-fa7fa3f435fdn%40googlegroups.com.

Justin Hannah

unread,
Jun 16, 2023, 4:46:40 PM6/16/23
to dnl-class4-user
Any idea for at least a workaround fix for this one?  my switch is down and now the weekend is coming...

Pradeep Patidar

unread,
Jun 16, 2023, 7:14:55 PM6/16/23
to dnl-class4-user
Hello Justin, 

You need to install the dnl_webbackend will just update the API.

To update the Web component, you use the following commands:
yum install dnlv6_webbackend (for the API )
yum install dnlv6_webui (for the web UI)

And after that, you need to cd to the /opt/denovo_v6/api_dnl  and run: alembic -c alembic.ini upgrade head

The reason is when there are database changes, database also needs to be upgraded, 
we have an alembic tool for automating database upgrades.

so,  alembic   or /usr/local/bin/alembic   -c alembic.ini upgrade head
those tables that are missing and new API requires it must be added

entering that command will allow you  to monitor the upgrade process to see if it was successful,

Thanks and Regards
Pradeep
> --
> Useful Links:
> Get Help - http://support.denovolab.com
> Tutorial - http://cookbook.denovolab.com
> Video Training - https://www.youtube.com/channel/UCIVrN4OSdY-r4l_FA4ekIBA
> User Manual - http://doc.denovolab.com
> ---
> You received this message because you are subscribed to the Google Groups "dnl-class4-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dnl-class4-us...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dnl-class4-user/58078100-afef-42ef-b5ea-fa7fa3f435fdn%40googlegroups.com.

Justin Hannah

unread,
Jun 16, 2023, 10:20:56 PM6/16/23
to dnl-class4-user
Hello,

I reinstalled these two modules and ran the command you suggested-


I am not able to install dnlv6-webbackend because of missing  python3-pjsua and also  dnlv6_webui as it depends on the webbackend...  If I need to back out the dnl-webui and dnl-webbackend and install the other somehow please let me know.


[root@sw api_dnl]# pwd
/opt/denovo_v6/api_dnl
[root@sw api_dnl]# /usr/local/bin/alembic -c alembic.ini upgrade head
/usr/local/lib/python3.6/site-packages/jwt/utils.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
  from cryptography.hazmat.primitives.asymmetric.utils import (
postgresql://webbackend:nopasswd@localhost:5432/class4_dnl
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade a502b727dcc1 -> d4a9baed505d, resource changes

Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.DuplicateColumn: column "ani_country_whitelist" of relation "resource" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/alembic", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 479, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 473, in main
    self.run_cmd(cfg, options)
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 456, in run_cmd
    **dict((k, getattr(options, k, None)) for k in kwarg)
  File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line 254, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", line 416, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", line 64, in load_module_py
    module_id, path).load_module(module_id)
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/env.py", line 94, in <module>
    run_migrations_online()
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/env.py", line 89, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", line 817, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 323, in run_migrations
    step.migration_fn(**kw)
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/versions/d4a9baed505d_resource_changes.py", line 32, in upgrade
    op.add_column('resource', sa.Column('ani_country_whitelist', sa.String(), nullable=True))
  File "<string>", line 8, in add_column
  File "<string>", line 3, in add_column
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/ops.py", line 1551, in add_column
    return operations.invoke(op)
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/base.py", line 318, in invoke
    return fn(self, operation)
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/toimpl.py", line 123, in add_column
    schema=schema
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 172, in add_column
    self._exec(base.AddColumn(table_name, column, schema=schema))
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 118, in _exec
    return conn.execute(construct, *multiparams, **params)

  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1002, in _execute_ddl
    compiled

  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateColumn) column "ani_country_whitelist" of relation "resource" already exists
 [SQL: 'ALTER TABLE resource ADD COLUMN ani_country_whitelist VARCHAR']





So I still have the same error trying to launch the service manually, and of course also the systemctl start fails.

[root@sw api_dnl]# cd /opt/denovo_v6/api_dnl

[root@sw api_dnl]# /usr/bin/api_dnl_run
Traceback (most recent call last):
  File "/usr/bin/api_dnl_run", line 33, in <module>
    sys.exit(load_entry_point('api-dnl==2.5.24', 'console_scripts', 'api_dnl_run')())
  File "/usr/bin/api_dnl_run", line 25, in importlib_load_entry_point
    return next(matches).load()
StopIteration
[root@sw api_dnl]#

Anne Kwong

unread,
Jun 18, 2023, 6:41:08 PM6/18/23
to Justin Hannah, dnl-class4-user
Hi Justin

This problem occurs because your RPM version is a bit old so it is not
compatible with latest RPM update.
If you reinstall with a new RPM instead of updating from this old
version, it should work perfectly fine.

Otherwise, please follow the following steps.


Please comment on these lines in alembic file :

### commands auto generated by Alembic - please adjust!

op.alter_column('did_client_log', 'released_on',
existing_type=postgresql.TIMESTAMP(timezone=True), nullable=True,
existing_server_default=sa.text('now()'))

#op.add_column('resource', sa.Column('ani_country_whitelist',
sa.String(), nullable=True))

#op.add_column('resource', sa.Column('block_toll_free_ani',
sa.Integer(), nullable=True))

#op.add_column('resource', sa.Column('block_wireless_ani',
sa.Boolean(), nullable=True))

#op.add_column('resource', sa.Column('invalid_ani_action',
sa.Boolean(), nullable=True))

#up_rec('resource') pass

### end Alembic commands


You should edit
/usr/lib/python3.6/site-packages/api_dnl/migrations/versions/d4a9baed505d_resource_changes.py
with some text editor, and alter content to look like this.

Thanks,
Anne
> To view this discussion on the web visit https://groups.google.com/d/msgid/dnl-class4-user/80a9670d-efef-45e6-9900-ad3eab699ae9n%40googlegroups.com.

Justin Hannah

unread,
Jun 19, 2023, 12:29:12 PM6/19/23
to dnl-class4-user
Hello, thanks for the instructions and advice.  I also had to do this type of editing on a bunch of other migrations and even after Alembic was successfully run, the api would still not start with the same error about version numbering.  So I backed up all the conf files and going to do a reinstall the switch with newer RPMs.

Justin
Reply all
Reply to author
Forward
0 new messages