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

ifconfig alternative #4

Closed
benjaoming opened this issue May 11, 2017 · 3 comments
Closed

ifconfig alternative #4

benjaoming opened this issue May 11, 2017 · 3 comments

Comments

@benjaoming
Copy link
Collaborator

From @benjaoming on May 2, 2017 10:26

Background: https://linuxconfig.org/how-to-install-missing-ifconfig-command-on-debian-linux

"ifconfig" was deprecated and is now removed in ubuntu 17.04. It can be installed with package net-tools, but we should perhaps just find workarounds.

Currently, subprocess throws and exception:


Traceback (most recent call last):
  File "/usr/bin/kalite", line 121, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/kalite/cli.py", line 843, in main
    port=arguments["--port"]
  File "/usr/lib/python2.7/dist-packages/kalite/cli.py", line 495, in start
    addresses = get_ip_addresses(include_loopback=False)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/bundled/fle_utils/internet/functions.py", line 108, in get_ip_addresses
    ips = [iface.get("inet") for iface in ifcfg.interfaces().values()]
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/__init__.py", line 60, in interfaces
    parser = get_parser()
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/__init__.py", line 44, in get_parser
    parser = LinuxParser(ifconfig=ifconfig)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/parser.py", line 159, in __init__
    super(LinuxParser, self).__init__(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/parser.py", line 141, in __init__
    super(UnixParser, self).__init__(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/parser.py", line 36, in __init__
    self.parse(self.ifconfig_data)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/parser.py", line 54, in parse
    ifconfig, err, retcode = exec_cmd(self._meta.ifconfig_cmd_args)
  File "/usr/lib/python2.7/dist-packages/kalite/packages/dist/ifcfg/tools.py", line 20, in exec_cmd
    proc = Popen(cmd_args, stdout=PIPE, stderr=PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Copied from original issue: learningequality/python-ifcfg#3

@benjaoming
Copy link
Collaborator Author

Fixed in da0f245

@benjaoming
Copy link
Collaborator Author

Released as 0.10

@benjaoming
Copy link
Collaborator Author

This didn't quite fix it, because __init__ calls parse - I wasn't reading the code right. So apparently the ifconfig_cmd gets set at load time, and then at initialization of the parser class, it's already calling parse which is kind of hard to deal with.

Needs a greater refactor :/

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