Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
f80cdaf1
Commit
f80cdaf1
authored
May 11, 2011
by
Michal 'vorner' Vaner
Browse files
[trac875] Loading of spec file
parent
c2693bb8
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/bin/cfgmgr/plugins/Makefile.am
View file @
f80cdaf1
SUBDIRS
=
tests
EXTRA_DIST
=
README
# TODO: We need to distribute the .py files and .spec files. We also need to
# install them. How to do that correctly?
src/bin/cfgmgr/plugins/tests/Makefile.am
View file @
f80cdaf1
...
...
@@ -10,7 +10,7 @@ if ENABLE_PYTHON_COVERAGE
endif
for
pytest
in
$(PYTESTS)
;
do
\
echo Running test
:
$$pytest ;
\
env PLUGIN_DIR=$(abs_srcdir)/..
\
env
B10_TEST_
PLUGIN_DIR=$(abs_srcdir)/..
:$(abs_builddir)/..
\
env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cfgmgr
\
$(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ;
\
done
...
...
src/bin/cfgmgr/plugins/tests/tsig_keys_test.py
View file @
f80cdaf1
...
...
@@ -16,7 +16,7 @@
# Make sure we can load the module, put it into path
import
sys
import
os
sys
.
path
.
app
end
(
os
.
environ
[
"PLUGIN_DIR"
])
sys
.
path
.
ext
end
(
os
.
environ
[
"
B10_TEST_
PLUGIN_DIR"
]
.
split
(
':'
)
)
import
tsig_keys
import
unittest
...
...
@@ -47,7 +47,7 @@ class TSigKeysTest(unittest.TestCase):
# Correct name
self
.
assertEqual
(
"tsig_keys"
,
spec
.
get_module_name
())
# There are no commands, nobody would handle them anyway
self
.
assertEqual
(
{}
,
spec
.
get_commands_spec
())
self
.
assertEqual
(
[]
,
spec
.
get_commands_spec
())
# There's some nonempty configuration
self
.
assertNotEqual
({},
spec
.
get_config_spec
())
...
...
src/bin/cfgmgr/plugins/tsig_keys.py
View file @
f80cdaf1
...
...
@@ -13,8 +13,10 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# TODO: Put the real spec definition here
spec
=
None
from
isc.config.module_spec
import
module_spec_from_file
from
isc.util.file
import
path_search
from
bind10_config
import
PLUGIN_PATHS
spec
=
module_spec_from_file
(
path_search
(
'tsig_keys.spec'
,
PLUGIN_PATHS
))
def
check
():
pass
...
...
src/lib/python/bind10_config.py.in
View file @
f80cdaf1
...
...
@@ -46,5 +46,8 @@ def reload():
PREFIX = "@prefix@"
DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
PLUGIN_PATHS = ["@prefix@/share/@PACKAGE@/config_plugins"]
# For testing the plugins so they can find their own spec files
if "B10_TEST_PLUGIN_DIR" in os.environ:
PLUGIN_PATHS = os.environ["B10_TEST_PLUGIN_DIR"].split(':')
reload()
src/lib/python/isc/util/file.py
View file @
f80cdaf1
...
...
@@ -26,4 +26,4 @@ def path_search(filename, paths):
f
=
join
(
p
,
filename
)
if
exists
(
f
):
return
f
raise
IOError
(
"'"
+
filename
+
"' not found
"
)
raise
IOError
(
"'"
+
filename
+
"' not found
in "
+
str
(
paths
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment