ZPESystems / Salt

Salt module for Nodegrid
GNU General Public License v3.0
1 stars 1 forks source link

traceback with nodegrid.import settings #2

Closed zpe-jose-deleon closed 1 year ago

zpe-jose-deleon commented 1 year ago

I attempted same import directly with nodegrid CLI and it succeeds, however it does reject two paths, otherwise it succeeds everywhere else. But when run through the salt-proxy, there is traceback

{'nodegrid_ngbsr-102': 'The minion function caused an exception: Traceback (most recent call last):\n File "/usr/lib/python3/dist-packages/salt/metaproxy/proxy.py", line 482, in thread_return\n return_data = minion_instance.executors[fname](\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in call\n return self.loader.run(run_func, *args, kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n return self._last_context.run(self._run_as, _func_or_method, *args, *kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n return _func_or_method(args, kwargs)\n File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 10, in execute\n return func(*args, kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in call\n return self.loader.run(run_func, *args, *kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n return self._last_context.run(self._run_as, _func_or_method, args, kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n return _func_or_method(args, kwargs)\n File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/modules/nodegrid.py", line 80, in import_settings\n return proxy["nodegrid.import_settings"](command, kwargs) # pylint: disable=undefined-variable\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in call\n return self.loader.run(run_func, args, kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n return self._last_context.run(self._run_as, _func_or_method, *args, *kwargs)\n File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n return _func_or_method(args, kwargs)\n File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/proxy/nodegrid.py", line 748, in import_settings\n output_dict = _exec_import_settings(conn_obj, import_settings_list, True)\n File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/proxy/nodegrid.py", line 371, in _exec_import_settings\n conn_obj.expect_exact(\'/]# \')\n File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 421, in expect_exact\n return exp.expect_loop(timeout)\n File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 181, in expect_loop\n return self.timeout(e)\n File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 144, in timeout\n raise exc\npexpect.exceptions.TIMEOUT: Timeout exceeded.\n<pexpect.pty_spawn.spawn object at 0x7f3b4ad92c20>\ncommand: /usr/bin/ssh\nargs: [\'/usr/bin/ssh\', \'-o\', \'UserKnownHostsFile=/dev/null\', \'-o\', \'StrictHostKeyChecking=no\', \'-o\', \'LogLevel=QUIET\', \'admin@192.168.74.239\']\nbuffer (last 100 chars): b\'ed\r\n\'\nbefore (last 100 chars): b\'ctions/hotspot Result: succeeded\r\nPath: /settings/network_connections/BACKPLANE0 Result: succeeded\r\n\'\nafter: <class \'pexpect.exceptions.TIMEOUT\'>\nmatch: None\nmatch_index: None\nexitstatus: None\nflag_eof: False\npid: 1772\nchild_fd: 25\nclosed: False\ntimeout: 60\ndelimiter: <class \'pexpect.exceptions.EOF\'>\nlogfile: None\nlogfile_read: <_io.BytesIO object at 0x7f3b5a9f7600>\nlogfile_send: None\nmaxread: 2000\nignorecase: False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose: 0.1\ndelayafterterminate: 0.1\nsearcher: searcher_string:\n 0: b\'/]# \'\n'}

jose-deleon@salty-01:~/Projects/ztp-nodegrids$ sudo python3 apply_nodegrid.py  --target nodegrid_ngbsr-102 --yaml_file ./ngbsr-102-base-config.yml 
/settings/authorization/admin/members memberRemote='admin,'
/settings/authorization/admin/profile apply_&_save_settings='yes'
/settings/authorization/admin/profile configure_system='yes'
/settings/authorization/admin/profile configure_user_accounts='yes'
/settings/authorization/admin/profile custom_session_timeout='no'
/settings/authorization/admin/profile manage_devices_permissions='no'
/settings/authorization/admin/profile menu-driven_access_to_devices='no'
/settings/authorization/admin/profile restrict_configure_system_permission_to_read_only='no'
/settings/authorization/admin/profile shell_access='yes'
/settings/authorization/admin/profile software_upgrade_and_reboot_system='yes'
/settings/authorization/admin/profile startup_application='cli'
/settings/authorization/admin/profile sudo_permission='no'
/settings/authorization/admin/profile terminate_sessions='yes'
/settings/authorization/admin/profile track_system_information='yes'
/settings/date_and_time date_and_time='network_time_protocol'
/settings/date_and_time enable_date_and_time_synchronization='no'
/settings/date_and_time server='3.us.pool.ntp.org'
/settings/date_and_time zone='utc'
/settings/devices/ttyS1/access allow_binary_socket='no'
/settings/devices/ttyS1/access allow_pre-shared_ssh_key='no'
/settings/devices/ttyS1/access allow_ssh_protocol='yes'
/settings/devices/ttyS1/access allow_telnet_protocol='yes'
/settings/devices/ttyS1/access baud_rate='9600'
/settings/devices/ttyS1/access data_bits='8'
/settings/devices/ttyS1/access enable_device_state_detection_based_in_data_flow='no'
/settings/devices/ttyS1/access enable_hostname_detection='no'
/settings/devices/ttyS1/access enable_ip_alias='no'
/settings/devices/ttyS1/access enable_second_ip_alias='no'
/settings/devices/ttyS1/access enable_serial_port_settings_via_escape_sequence='yes'
/settings/devices/ttyS1/access escape_sequence='^Ec'
/settings/devices/ttyS1/access flow_control='None'
/settings/devices/ttyS1/access icon='terminal.png'
/settings/devices/ttyS1/access launch_url_via_html5='yes'
/settings/devices/ttyS1/access mode='disabled'
/settings/devices/ttyS1/access multisession='yes'
/settings/devices/ttyS1/access name='ttyS1'
/settings/devices/ttyS1/access ocp_command_key='^Z'
/settings/devices/ttyS1/access parity='None'
/settings/devices/ttyS1/access password='********'
/settings/devices/ttyS1/access power_control_key='^O'
/settings/devices/ttyS1/access read-write_multisession='no'
/settings/devices/ttyS1/access rs-232_signal_for_device_state_detection='Auto'
/settings/devices/ttyS1/access show_text_information='yes'
/settings/devices/ttyS1/access skip_authentication_to_access_device='no'
/settings/devices/ttyS1/access stop_bits='1'
/settings/devices/ttyS1/access telnet_port='7001'
/settings/devices/ttyS1/access type='local_serial'
/settings/devices/ttyS1/commands/console command='console'
/settings/devices/ttyS1/commands/console enabled='yes'
/settings/devices/ttyS1/commands/console launch_local_application='no'
/settings/devices/ttyS1/commands/data_logging command='data_logging'
/settings/devices/ttyS1/commands/data_logging enabled='no'
/settings/devices/ttyS1/logging data_logging='no'
/settings/devices/ttyS1/management monitoring_nominal='no'
/settings/devices/ttyS1 {spm_rename}='{spm_rename},ttyS1,spm_name'
/settings/ipv4_firewall/chains/INPUT/0 enable_state_match='no'
/settings/ipv4_firewall/chains/INPUT/0 fragments='all_packets_and_fragments'
/settings/ipv4_firewall/chains/INPUT/0 input_interface='lo'
/settings/ipv4_firewall/chains/INPUT/0 log_level='debug'
/settings/ipv4_firewall/chains/INPUT/0 log_options_from_the_ip_packet_header='no'
/settings/ipv4_firewall/chains/INPUT/0 log_options_from_the_tcp_packet_header='no'
/settings/ipv4_firewall/chains/INPUT/0 log_tcp_sequence_numbers='no'
/settings/ipv4_firewall/chains/INPUT/0 output_interface='any'
/settings/ipv4_firewall/chains/INPUT/0 protocol='numeric'
/settings/ipv4_firewall/chains/INPUT/0 reject_with='port_unreacheable'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_destination_ip|mask='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_destination_port='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_icmp_type='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_input_interface='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_output_interface='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_protocol='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_source_ip|mask='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_source_port='no'
/settings/ipv4_firewall/chains/INPUT/0 reverse_match_for_tcp_flags='no'
/settings/ipv4_firewall/chains/INPUT/0 rule_number='0'
/settings/ipv4_firewall/chains/INPUT/0 target='ACCEPT'
/settings/ipv4_firewall/chains/OUTPUT/0 enable_state_match='no'
/settings/ipv4_firewall/chains/OUTPUT/0 fragments='all_packets_and_fragments'
/settings/ipv4_firewall/chains/OUTPUT/0 input_interface='any'
/settings/ipv4_firewall/chains/OUTPUT/0 log_level='debug'
/settings/ipv4_firewall/chains/OUTPUT/0 log_options_from_the_ip_packet_header='no'
/settings/ipv4_firewall/chains/OUTPUT/0 log_options_from_the_tcp_packet_header='no'
/settings/ipv4_firewall/chains/OUTPUT/0 log_tcp_sequence_numbers='no'
/settings/ipv4_firewall/chains/OUTPUT/0 output_interface='lo'
/settings/ipv4_firewall/chains/OUTPUT/0 protocol='numeric'
/settings/ipv4_firewall/chains/OUTPUT/0 reject_with='port_unreacheable'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_destination_ip|mask='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_destination_port='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_icmp_type='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_input_interface='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_output_interface='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_protocol='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_source_ip|mask='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_source_port='no'
/settings/ipv4_firewall/chains/OUTPUT/0 reverse_match_for_tcp_flags='no'
/settings/ipv4_firewall/chains/OUTPUT/0 rule_number='0'
/settings/ipv4_firewall/chains/OUTPUT/0 target='ACCEPT'
/settings/ipv4_firewall/policy FORWARD='ACCEPT'
/settings/ipv4_firewall/policy INPUT='ACCEPT'
/settings/ipv4_firewall/policy OUTPUT='ACCEPT'
/settings/ipv4_nat/policy INPUT='ACCEPT'
/settings/ipv4_nat/policy OUTPUT='ACCEPT'
/settings/ipv4_nat/policy POSTROUTING='ACCEPT'
/settings/ipv4_nat/policy PREROUTING='ACCEPT'
/settings/ipv6_firewall/chains/INPUT/0 enable_state_match='no'
/settings/ipv6_firewall/chains/INPUT/0 fragments='all_packets_and_fragments'
/settings/ipv6_firewall/chains/INPUT/0 input_interface='lo'
/settings/ipv6_firewall/chains/INPUT/0 log_level='debug'
/settings/ipv6_firewall/chains/INPUT/0 log_options_from_the_ip_packet_header='no'
/settings/ipv6_firewall/chains/INPUT/0 log_options_from_the_tcp_packet_header='no'
/settings/ipv6_firewall/chains/INPUT/0 log_tcp_sequence_numbers='no'
/settings/ipv6_firewall/chains/INPUT/0 output_interface='any'
/settings/ipv6_firewall/chains/INPUT/0 protocol='numeric'
/settings/ipv6_firewall/chains/INPUT/0 reject_with='no_route'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_destination_ip|mask='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_destination_port='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_icmp_type='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_input_interface='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_output_interface='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_protocol='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_source_ip|mask='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_source_port='no'
/settings/ipv6_firewall/chains/INPUT/0 reverse_match_for_tcp_flags='no'
/settings/ipv6_firewall/chains/INPUT/0 rule_number='0'
/settings/ipv6_firewall/chains/INPUT/0 target='ACCEPT'
/settings/ipv6_firewall/chains/OUTPUT/0 enable_state_match='no'
/settings/ipv6_firewall/chains/OUTPUT/0 fragments='all_packets_and_fragments'
/settings/ipv6_firewall/chains/OUTPUT/0 input_interface='any'
/settings/ipv6_firewall/chains/OUTPUT/0 log_level='debug'
/settings/ipv6_firewall/chains/OUTPUT/0 log_options_from_the_ip_packet_header='no'
/settings/ipv6_firewall/chains/OUTPUT/0 log_options_from_the_tcp_packet_header='no'
/settings/ipv6_firewall/chains/OUTPUT/0 log_tcp_sequence_numbers='no'
/settings/ipv6_firewall/chains/OUTPUT/0 output_interface='lo'
/settings/ipv6_firewall/chains/OUTPUT/0 protocol='numeric'
/settings/ipv6_firewall/chains/OUTPUT/0 reject_with='no_route'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_destination_ip|mask='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_destination_port='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_icmp_type='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_input_interface='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_output_interface='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_protocol='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_source_ip|mask='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_source_port='no'
/settings/ipv6_firewall/chains/OUTPUT/0 reverse_match_for_tcp_flags='no'
/settings/ipv6_firewall/chains/OUTPUT/0 rule_number='0'
/settings/ipv6_firewall/chains/OUTPUT/0 target='ACCEPT'
/settings/ipv6_firewall/policy FORWARD='ACCEPT'
/settings/ipv6_firewall/policy INPUT='ACCEPT'
/settings/ipv6_firewall/policy OUTPUT='ACCEPT'
/settings/ipv6_nat/policy INPUT='ACCEPT'
/settings/ipv6_nat/policy OUTPUT='ACCEPT'
/settings/ipv6_nat/policy POSTROUTING='ACCEPT'
/settings/ipv6_nat/policy PREROUTING='ACCEPT'
/settings/local_accounts/admin account_type='regular_account'
/settings/local_accounts/admin hash_format_password='no'
/settings/local_accounts/admin password_change_at_login='no'
/settings/local_accounts/admin user_group='admin'
/settings/local_accounts/admin username='admin'
/settings/network_connections/BACKPLANE0 block_unsolicited_incoming_packets='no'
/settings/network_connections/BACKPLANE0 connect_automatically='yes'
/settings/network_connections/BACKPLANE0 enable_ip_passthrough='no'
/settings/network_connections/BACKPLANE0 enable_lldp='no'
/settings/network_connections/BACKPLANE0 ethernet_interface='backplane0'
/settings/network_connections/BACKPLANE0 ethernet_link_mode='auto'
/settings/network_connections/BACKPLANE0 ipv4_default_route_metric='100'
/settings/network_connections/BACKPLANE0 ipv4_ignore_obtained_default_gateway='no'
/settings/network_connections/BACKPLANE0 ipv4_ignore_obtained_dns_server='no'
/settings/network_connections/BACKPLANE0 ipv4_mode='dhcp'
/settings/network_connections/BACKPLANE0 ipv6_default_route_metric='100'
/settings/network_connections/BACKPLANE0 ipv6_ignore_obtained_default_gateway='no'
/settings/network_connections/BACKPLANE0 ipv6_ignore_obtained_dns_server='no'
/settings/network_connections/BACKPLANE0 ipv6_mode='address_auto_configuration'
/settings/network_connections/BACKPLANE0 name='BACKPLANE0'
/settings/network_connections/BACKPLANE0 set_as_primary_connection='no'
/settings/network_connections/BACKPLANE0 type='ethernet'
/settings/network_connections/ETH0 block_unsolicited_incoming_packets='no'
/settings/network_connections/ETH0 connect_automatically='yes'
/settings/network_connections/ETH0 enable_ip_passthrough='no'
/settings/network_connections/ETH0 enable_lldp='no'
/settings/network_connections/ETH0 ethernet_interface='eth0'
/settings/network_connections/ETH0 ethernet_link_mode='auto'
/settings/network_connections/ETH0 ipv4_default_route_metric='90'
/settings/network_connections/ETH0 ipv4_ignore_obtained_default_gateway='no'
/settings/network_connections/ETH0 ipv4_ignore_obtained_dns_server='no'
/settings/network_connections/ETH0 ipv4_mode='dhcp'
/settings/network_connections/ETH0 ipv6_default_route_metric='90'
/settings/network_connections/ETH0 ipv6_ignore_obtained_default_gateway='no'
/settings/network_connections/ETH0 ipv6_ignore_obtained_dns_server='no'
/settings/network_connections/ETH0 ipv6_mode='address_auto_configuration'
/settings/network_connections/ETH0 name='ETH0'
/settings/network_connections/ETH0 set_as_primary_connection='yes'
/settings/network_connections/ETH0 type='ethernet'
/settings/network_connections/hotspot block_unsolicited_incoming_packets='no'
/settings/network_connections/hotspot connect_automatically='yes'
/settings/network_connections/hotspot enable_lldp='no'
/settings/network_connections/hotspot hotspot_ipv4_mode='server'
/settings/network_connections/hotspot hotspot_ipv6_mode='no_ipv6_address'
/settings/network_connections/hotspot name='hotspot'
/settings/network_connections/hotspot psk='********'
/settings/network_connections/hotspot region='00'
/settings/network_connections/hotspot set_as_primary_connection='no'
/settings/network_connections/hotspot shared_ipv4_address='192.168.162.1'
/settings/network_connections/hotspot shared_ipv4_bitmask='24'
/settings/network_connections/hotspot type='wifi'
/settings/network_connections/hotspot wifi_band='2_4ghz'
/settings/network_connections/hotspot wifi_security='wpa2_personal'
/settings/network_connections/hotspot wifi_ssid='********'
/settings/network_settings domain_name='localdomain'
/settings/network_settings enable_bluetooth_network='yes'
/settings/network_settings enable_dynamic_dns='no'
/settings/network_settings enable_ipv4_ip_forward='no'
/settings/network_settings enable_ipv6_ip_forward='no'
/settings/network_settings enable_multiple_routing_tables='yes'
/settings/network_settings enable_network_failover='no'
/settings/network_settings enable_primary_failover_by_data_usage='no'
/settings/network_settings enable_primary_failover_by_ip_address='yes'
/settings/network_settings enable_primary_failover_by_schedule='no'
/settings/network_settings enable_primary_failover_by_signal_strength='no'
/settings/network_settings enable_primary_sim_failback_by_schedule='no'
/settings/network_settings enable_secondary_failover_by_data_usage='no'
/settings/network_settings enable_secondary_failover_by_ip_address='yes'
/settings/network_settings enable_secondary_failover_by_schedule='no'
/settings/network_settings enable_secondary_failover_by_signal_strength='no'
/settings/network_settings enable_secondary_sim_failback_by_schedule='no'
/settings/network_settings hostname='JOSE-DESK'
/settings/network_settings reverse_path_filtering='strict_mode'
/settings/network_settings secondary_trigger='secondary_ipv4_default_gateway'
/settings/network_settings trigger='ipv4_default_gateway'
/settings/ntp_server enable_ntp_server='no'
/settings/services allow_root_console_access='no'
/settings/services auto_cluster_enroll='yes'
/settings/services block_host_with_multiple_authentication_fails='no'
/settings/services bluetooth_discoverable_mode='yes'
/settings/services bluetooth_display_name='NGB-SR_220211018'
/settings/services cipher_suite_level='medium'
/settings/services cluster_tcp_port='9966'
/settings/services device_access_per_user_group_authorization='no'
/settings/services dhcp_lease_per_autodiscovery_rules='no'
/settings/services enable_autodiscovery='yes'
/settings/services enable_bluetooth='yes'
/settings/services enable_detection_of_usb_devices='yes'
/settings/services enable_docker='no'
/settings/services enable_elasticsearch='yes'
/settings/services enable_ftp_service='no'
/settings/services enable_grpc='no'
/settings/services enable_http_access='yes'
/settings/services enable_https_access='yes'
/settings/services enable_https_file_repository='no'
/settings/services enable_icmp_echo_reply='yes'
/settings/services enable_icmp_secure_redirects='yes'
/settings/services enable_kibana='yes'
/settings/services enable_pxe='yes'
/settings/services enable_qemu|kvm='no'
/settings/services enable_reboot_on_services_status_page='yes'
/settings/services enable_rpc='no'
/settings/services enable_search_engine_high_level_cipher_suite='no'
/settings/services enable_services_status_page='yes'
/settings/services enable_snmp_service='yes'
/settings/services enable_telegraf='no'
/settings/services enable_telnet_service_to_managed_devices='no'
/settings/services enable_telnet_service_to_nodegrid='no'
/settings/services enable_usb_over_ip='no'
/settings/services enable_vm_serial_access='yes'
/settings/services enable_vmware_manager='yes'
/settings/services enable_zero_touch_provisioning='yes'
/settings/services frr_enable_bgp='yes'
/settings/services frr_enable_ospfv2='no'
/settings/services frr_enable_ospfv3='no'
/settings/services frr_enable_rip='no'
/settings/services frr_enable_vrrp='no'
/settings/services http_port='80'
/settings/services https_port='443'
/settings/services password_protected_boot='no'
/settings/services redirect_http_to_https='yes'
/settings/services rescue_mode_require_authentication='no'
/settings/services search_engine_tcp_port='9300'
/settings/services ssh_allow_root_access='no'
/settings/services ssh_tcp_port='22'
/settings/services tlsv1='no'
/settings/services tlsv1.1='no'
/settings/services tlsv1.2='yes'
/settings/services tlsv1.3='yes'
/settings/services vm_serial_port='9977'
/settings/services vmotion_timeout='300'
/settings/system_preferences console_port_speed='115200'
/settings/system_preferences enable_banner='no'
/settings/system_preferences enable_license_utilization_rate='yes'
/settings/system_preferences enable_local_serial_ports_utilization_rate='no'
/settings/system_preferences help_url='https://www.zpesystems.com/ng/v5_6/NodegridManual5.6.html'
/settings/system_preferences idle_timeout='3600'
/settings/system_preferences iso_url='http://ServerIPAddress/PATH/FILENAME.ISO'
/settings/system_preferences logo_download_path_is_absolute_path_name='no'
/settings/system_preferences logo_image='use_default_logo_image'
/settings/system_preferences percentage_to_trigger_events='90'
/settings/system_preferences revision_tag='r1'
/settings/system_preferences show_hostname_on_webui_header='yes'
/settings/system_preferences unit_interface='eth0'
/settings/system_preferences unit_ipv4_address='192.168.160.1'
/settings/system_preferences unit_netmask='255.255.255.0'
/settings/zpe_cloud enable_file_encryption='no'
/settings/zpe_cloud enable_file_protection='no'
/settings/zpe_cloud enable_remote_access='yes'
/settings/zpe_cloud enable_zpe_cloud='yes'
{'nodegrid_ngbsr-102': 'The minion function caused an exception: Traceback (most recent call last):\n  File "/usr/lib/python3/dist-packages/salt/metaproxy/proxy.py", line 482, in thread_return\n    return_data = minion_instance.executors[fname](\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__\n    return self.loader.run(run_func, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n    return _func_or_method(*args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 10, in execute\n    return func(*args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__\n    return self.loader.run(run_func, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n    return _func_or_method(*args, **kwargs)\n  File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/modules/nodegrid.py", line 80, in import_settings\n    return __proxy__["nodegrid.import_settings"](command, **kwargs) # pylint: disable=undefined-variable\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__\n    return self.loader.run(run_func, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run\n    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)\n  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as\n    return _func_or_method(*args, **kwargs)\n  File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/proxy/nodegrid.py", line 748, in import_settings\n    output_dict = _exec_import_settings(conn_obj, import_settings_list, True)\n  File "/var/cache/salt/proxy/extmods/nodegrid_ngbsr-102/proxy/nodegrid.py", line 371, in _exec_import_settings\n    conn_obj.expect_exact(\'/]# \')\n  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 421, in expect_exact\n    return exp.expect_loop(timeout)\n  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 181, in expect_loop\n    return self.timeout(e)\n  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 144, in timeout\n    raise exc\npexpect.exceptions.TIMEOUT: Timeout exceeded.\n<pexpect.pty_spawn.spawn object at 0x7f3b4ad92c20>\ncommand: /usr/bin/ssh\nargs: [\'/usr/bin/ssh\', \'-o\', \'UserKnownHostsFile=/dev/null\', \'-o\', \'StrictHostKeyChecking=no\', \'-o\', \'LogLevel=QUIET\', \'admin@192.168.74.239\']\nbuffer (last 100 chars): b\'ed\\r\\n\'\nbefore (last 100 chars): b\'ctions/hotspot Result: succeeded\\r\\nPath: /settings/network_connections/BACKPLANE0 Result: succeeded\\r\\n\'\nafter: <class \'pexpect.exceptions.TIMEOUT\'>\nmatch: None\nmatch_index: None\nexitstatus: None\nflag_eof: False\npid: 1772\nchild_fd: 25\nclosed: False\ntimeout: 60\ndelimiter: <class \'pexpect.exceptions.EOF\'>\nlogfile: None\nlogfile_read: <_io.BytesIO object at 0x7f3b5a9f7600>\nlogfile_send: None\nmaxread: 2000\nignorecase: False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose: 0.1\ndelayafterterminate: 0.1\nsearcher: searcher_string:\n    0: b\'/]# \'\n'}
jose-deleon@salty-01:~/Projects/ztp-nodegrids$ 
zpe-reneneumann commented 1 year ago

@zpe-jose-deleon Can you provide your phyton code? Further to that, what Nodegrid version are you using? The error was caused by a Webserver Timeout. @zpe-diegor is there a better way of catching the Webserver timeouts and failing more gracefully?

zpe-jose-deleon commented 1 year ago

ztp-nodegrids.tar.gz

@zpe-diegor I have attached the code I used. Run command: python3 ztp-nodegrid.py --target nodegrid_ngbsr-102 < configs/ngbsr-102.yml

Replace target with your salt target. If you are not root, prefix with sudo

zpe-diegor commented 1 year ago

@zpe-jose-deleon Thanks for reporting this issue. Although I could not execute your example:

yocto@builder-ng5 ~/workdir/ztp-nodegrids $ sudo python3 ztp-nodegrid.py --target nodegrid < configs/ngbsr-102.cli
[ERROR   ] An un-handled exception was caught by Salt's global exception handler:
TypeError: 'type' object is not subscriptable
Traceback (most recent call last):
  File "ztp-nodegrid.py", line 15, in <module>
    ng.load(data)
  File "/home/yocto/workdir/ztp-nodegrids/nodegrid_utils/__init__.py", line 33, in load
    self.from_settings(data)
  File "/home/yocto/workdir/ztp-nodegrids/nodegrid_utils/__init__.py", line 36, in from_settings
    def _recurse(d: dict, chain: list[str], value: str):
TypeError: 'type' object is not subscriptable

Investigation

Depending on Nodegrid versions, the CLI has a bad performance and timeouts so this can be expected in some cases, for instance Managed Devices, but this is not the case here.

From traceback, this issue happened after we sent control-d, paths are being processed but we expected a CLI prompt within the timeout of 30s only, but import processing took more time than that and timed out at at BACKPLANE0:

before (last 100 chars): b'ctions/hotspot Result: succeeded\r\nPath: /settings/network_connections/BACKPLANE0 Result: succeeded

As talked with @zpe-leonardof we will apply a fix to calculate a timeout number for the number of different paths included of the import blob to avoid this issue.

zpe-diegor commented 1 year ago

To replicate, one can make a import_settings using template provided, at ztp-nodegrids.tar.gz on ztp-nodegrids/configs/ngbsr-102.cli

tar -xf ztp-nodegrids.tar.gz
cd ztp-nodegrids
cp configs/ngbsr-102.cli /srv/salt/import_test_large.cli
sudo salt <TARGET> nodegrid.import_settings_file salt://import_test_large.cli --timeout 1500
# current results: traceback and did not finished import procedure
# expected results: True or False (some import lines may be rejected)