Kintyre / shinnecock-agent

Standalone client for Kintyre Speed Testing
2 stars 0 forks source link

agent fails with no parameters #21

Open brian-kennedy opened 5 years ago

brian-kennedy commented 5 years ago

C:>python -V Python 2.7.15

C:\>kintyre-speedtest
interface:  None
mode=default    interface:  None
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\kintyre-speedtest.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\kintyre_speedtest.py", line 808, in cli
    interfaces = find_matching_interfaces(args.interface_select, args.interface, r"^(u|v|)tun$")
  File "c:\python27\lib\site-packages\kintyre_speedtest.py", line 325, in find_matching_interfaces
    dflt = ifcfg.default_interface()
  File "c:\python27\lib\site-packages\ifcfg\__init__.py", line 77, in default_interface
    return Parser(ifconfig=ifconfig)._default_interface(route_output=route_output)
AttributeError: 'WindowsParser' object has no attribute '_default_interface'
C:\>kintyre-speedtest --help
usage: kintyre-speedtest [-h] [--version] [--config CONFIG] [--no-prompt]
                         [--register] [--url URL] [--token TOKEN]
                         [--interface INTERFACE [INTERFACE ...]]
                         [--randomize SECS] [--speedtest-debug]
                         [--random | --all | --default] [--fake-it]

Kintyre speedtest agent

optional arguments:
  -h, --help            show this help message and exit
  --version, -V         show program's version number and exit
  --config CONFIG, -c CONFIG
                        Location of the config file. Defaults to
                        ~\.kintyre_speedtest.ini
  --no-prompt           Disable interactive prompting.
  --register            Enable registration mode. No speedtest is run in this
                        mode.
  --interface INTERFACE [INTERFACE ...], -i INTERFACE [INTERFACE ...]
                        Name of interface(s) to speedtest. No other interfaces
                        will be considered. When used with --random then one
                        of the provided interfaces will be selected randomly.
  --randomize SECS      Add a random delay before running the speedtest. This
                        can avoid kicking off multiple test at the same
                        moment.
  --speedtest-debug     Enable speedtest internal debugging features. Very
                        much noise.
  --random              Randomly pick and test a single interface to test on
  --all                 Test against all usable interfaces.
  --default             Run speedtest on the interface with a default gateway.
                        (This is the default behavior, unless the --interface
                        option is provided)
  --fake-it             Disable speedtest functionality and return a bogus
                        payload instead. ONLY useful for testing.

Endpoint Settings:
  --url URL             URL of the Splunk HEC (HTTP Event Collector)
  --token TOKEN         Authentication token for Splunk HEC.

C:\>

image

lowell80 commented 5 years ago

This is a known bug in ifcfg, the library we use to collect network interface information. @ljonsson or @jpapasadora either of you have any ideas about how you'd determine what interface is "default" on a Windows box? Looking at the sample output in the unit tests it's not immediately obvious to me what interface should be "default". If we can figure it out, we should try to contribute a fix to the folks over at ifcfg and get them to roll a new release, they've been most helpful last time we ran into an issue.

Or we could just workaround the issue and fall back to "random" mode, or log a warning to the user (if more than 1 interface exists, which may not be a typical for non-server devices.)

bbarnett07 commented 5 years ago

We are working on a permanent solution for Windows users who receive an Attribute error regarding the default_interface when running the kintyre-speedtest after the initial register. Presently, you can bypass this error by running 'kintyre-speedtest --random'.