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

当 hosts 文件配置错误时,genie 不能初始化 #247

Closed
falseUtopia opened this issue Mar 16, 2022 · 1 comment
Closed

当 hosts 文件配置错误时,genie 不能初始化 #247

falseUtopia opened this issue Mar 16, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@falseUtopia
Copy link

Windows version (build number):
Microsoft Windows [版本 10.0.19044.1586]

Linux distribution:
20.04.4 LTS (Focal Fossa)

Genie version:
genie 2.0

Describe the bug

我的hosts 配置文件像这样时
image
执行 genie -s
image

$ genie -s
genie: WARNING: systemd default target is default.target; targets other than multi-user.target may not work
genie: WARNING: if you wish to use a different target, this warning can be disabled in the config file
genie: WARNING: if you experience problems, please change the target to multi-user.target
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/genie/genie/main.py", line 791, in
File "/usr/lib/genie/genie/main.py", line 775, in entrypoint
File "/usr/lib/genie/genie/main.py", line 515, in do_initialize
File "/usr/lib/genie/genie/main.py", line 221, in hostname_update
File "/usr/lib/genie/genie/main.py", line 257, in modify_hosts_file_entries
File "/usr/lib/genie/genie/python_hosts/hosts.py", line 157, in init
File "/usr/lib/genie/genie/python_hosts/hosts.py", line 496, in populate_entries
File "/usr/lib/genie/genie/python_hosts/hosts.py", line 54, in init
Exception: Address and Name(s) must be specified.
could not initialise bottle, exit code = 1

Confirm that you are running inside the bottle:
no-bottle

To Reproduce
Steps to reproduce the behavior:
例子:

  1. 配置你的hosts文件 (我知道这并不是规范的hosts配置方式,我只希望genie的代码更有健壮性)

192.168.31.1 hostname1.com
192.168.31.2
192.168.31.3 hostname3.com

  1. wslUbuntu内 安装 genie
  2. 执行 genie -s

Expected behavior
正常时控制台会提示等待 name.service 启动

Additional context
我看了代码,是在这个文件操作的

https://github.com/arkane-systems/genie/blob/master/binsrc/genie/__main__.py 的259行

... hosts.find_all_matching (name = old_name) ...
当我修改hosts文件使其变得正常时, 一切都正常了

I confirm that I have read the ENTIRE supplied readme file and checked for relevant information on the repository wiki before raising this issue, and that if the solution to this issue is found in either location, it will be closed without further comment:

  • [Yes ] .
@falseUtopia falseUtopia added the bug Something isn't working label Mar 16, 2022
cerebrate added a commit that referenced this issue Mar 17, 2022
@cerebrate
Copy link
Member

Thanks for the catch! (I was expecting the upstream package to be robust against this sort of thing, but I guess not.)

I've added a fix for this to 2.3.

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

2 participants