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

Bind configuration check actor got an stacktrace if one of file included from /etc/named.conf is empty #85

Open
SandakovMM opened this issue Aug 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@SandakovMM
Copy link

Actual behavior
Bind configuration got an stack trace when one of files to parse is empty.
The stack trace is:

        Check whether we are on legacy (BIOS) system and instruct Leapp to upgrade GRUB core
====> * check_se_linux
        Check SELinux status and produce decision messages for further action.
====> * check_postfix
        Check if postfix is installed, check whether configuration update is needed.
====> * check_bind
        Actor parsing BIND configuration and checking for known issues in it.
Process Process-442:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 72, in _do_run
    actor_instance.run(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 290, in run
    self.process(*args)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/checkbind/actor.py", line 32, in process
    facts = iscmodel.get_facts('/etc/named.conf')
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/checkbind/libraries/iscmodel.py", line 81, in get_facts
    parser.walk(cfg.root_section(), find_calls, state)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/isccfg.py", line 879, in walk
    for statement in it:
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/isccfg.py", line 223, in __next__
    statement = next(self.iter)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/isccfg.py", line 181, in __next__
    val = self.parser.find_next_key(cfg, index, self.section.end)
  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/isccfg.py", line 689, in find_next_key
    while istr[index] in self.CHAR_KEYWORD and index < end_index:
IndexError: string index out of range

To Reproduce

  1. Add empty file what we will include: touch /etc/named-user-options.conf
  2. Add include directive for into /etc/named.conf into options section with /etc/named-user-options.conf
  3. leapp preupgrade

Expected behavior
Leapp skip empty file and proceed to work

System information (please complete the following information):

# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

# uname -a
Linux ip-10-69-45-134.eu-west-1.compute.internal 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
# rpm -qa "*leapp*"
python2-leapp-0.14.0-1.el7.noarch
leapp-upgrade-el7toel8-deps-0.16.0-6.el7.elevate.16.noarch
leapp-upgrade-el7toel8-0.16.0-6.el7.elevate.16.noarch
leapp-data-almalinux-0.1-6.el7.noarch
leapp-deps-0.14.0-1.el7.noarch
leapp-0.14.0-1.el7.noarch

Attached logfiles

@SandakovMM SandakovMM added the bug Something isn't working label Aug 24, 2023
@SandakovMM
Copy link
Author

PR request with possible fix: oamg#1124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant