sk2/autonetkit — Issue #68: Don't import all modules automatically (especially deploy with pexpect dependency)
Author: sk2
Created: 2011-11-01 02:46:50+00:00
State: open

Pexpect requires ssh which may not be present in windows.
At the moment import all modules automatically:

import AutoNetkit.internal
from AutoNetkit.internal import *

remove this for deploy:

import AutoNetkit.deploy
from AutoNetkit.deploy import *

to then use:
nkd = ank.deploy.NetkitDeploy()

instead of
nkd = ank.NetkitDeploy()

This is tidier also for most tasks - may need to review namespace in the future, only automatically import the main functions.

```
C:\Python27\Scripts>autonetkit -f test.graphml --junos --ospf
Traceback (most recent call last):
File "C:\Python27\Scripts\autonetkit-script.py", line 8, in
load_entry_point('AutoNetkit==0.5.54dev-20111029', 'console_scripts', 'auton
etkit')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 318, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2221, in load_entr
y_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\AutoNetkit\__init__.py", line 8, in
import AutoNetkit.deploy
File "C:\Python27\lib\site-packages\AutoNetkit\deploy\__init__.py", line 2, in

from AutoNetkit.deploy.netkit_deploy import *
File "C:\Python27\lib\site-packages\AutoNetkit\deploy\netkit_deploy.py", line
16, in
import pexpect
File "C:\Python27\lib\site-packages\pexpect.py", line 86, in
support it. Pexpect is intended for UNIX-like operating systems.""")
```