aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/make-django-script.py37
-rw-r--r--rpkid/Makefile.in11
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-reset-demo.py7
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-sync-users.py30
-rw-r--r--rpkid/rpki/gui/script_util.py14
5 files changed, 40 insertions, 59 deletions
diff --git a/buildtools/make-django-script.py b/buildtools/make-django-script.py
deleted file mode 100644
index c8b3ef68..00000000
--- a/buildtools/make-django-script.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""
-Prepend boilerplate required for scripts which make use of Django's ORM.
-
-$Id$
-
-Copyright (C) 2011 Internet Systems Consortium ("ISC")
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-"""
-
-import os, sys
-
-sys.stdout.write('''\
-#!%(AC_PYTHON_INTERPRETER)s
-# Automatically constructed script header
-
-import sys, os
-# sys.path[0] is the cwd of the script being executed, so we add the
-# path to the settings.py file after it
-sys.path.insert(1, '%(AC_PYTHONPATH)s')
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
-# Original script starts here
-
-''' % os.environ)
-
-sys.stdout.write(sys.stdin.read())
diff --git a/rpkid/Makefile.in b/rpkid/Makefile.in
index df7804fa..22bd260d 100644
--- a/rpkid/Makefile.in
+++ b/rpkid/Makefile.in
@@ -234,13 +234,6 @@ COMPILE_PYTHON = \
${PYTHON} ${abs_top_srcdir}/buildtools/make-python-executable.py <$? >$@; \
chmod 555 $@
-COMPILE_DJANGO = \
- rm -f $@; \
- AC_PYTHON_INTERPRETER='${PYTHON}' \
- AC_PYTHONPATH='${sysconfdir}/rpki' \
- ${PYTHON} ${abs_top_srcdir}/buildtools/make-django-script.py <$? >$@; \
- chmod 555 $@
-
COMPILE_SETTINGS = \
rm -f $@; \
AC_SECRET_KEY='${SECRET_KEY}' \
@@ -284,7 +277,7 @@ portal-gui/scripts/rpkigui-import-routes: portal-gui/scripts/rpkigui-import-rout
${COMPILE_PYTHON}
portal-gui/scripts/rpkigui-reset-demo: portal-gui/scripts/rpkigui-reset-demo.py
- ${COMPILE_DJANGO}
+ ${COMPILE_PYTHON}
portal-gui/scripts/rpkigui-check-expired: portal-gui/scripts/rpkigui-check-expired.py
${COMPILE_PYTHON}
@@ -293,7 +286,7 @@ portal-gui/scripts/rpkigui-flatten-roas: portal-gui/scripts/rpkigui-flatten-roas
${COMPILE_PYTHON}
portal-gui/scripts/rpkigui-sync-users: portal-gui/scripts/rpkigui-sync-users.py
- ${COMPILE_DJANGO}
+ ${COMPILE_PYTHON}
portal-gui/rpki.wsgi: ${srcdir}/portal-gui/rpki.wsgi.in
sed -e "s|@VIRTUAL"_"ENV@|${VIRTUAL_ENV}|" \
diff --git a/rpkid/portal-gui/scripts/rpkigui-reset-demo.py b/rpkid/portal-gui/scripts/rpkigui-reset-demo.py
index acfddabd..ddb9fcef 100644
--- a/rpkid/portal-gui/scripts/rpkigui-reset-demo.py
+++ b/rpkid/portal-gui/scripts/rpkigui-reset-demo.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+# Copyright (C) 2012, 2013 SPARTA, Inc. a Parsons Company
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -21,6 +21,11 @@ issued by the labuser accounts.
__version__ = '$Id$'
+from rpki.gui.script_util import setup
+setup()
+
+import sys
+
from rpki.irdb.models import ROARequest, GhostbusterRequest, ResourceHolderCA
from rpki.gui.app.glue import list_received_resources
diff --git a/rpkid/portal-gui/scripts/rpkigui-sync-users.py b/rpkid/portal-gui/scripts/rpkigui-sync-users.py
index 0f15c65d..9c636e95 100644
--- a/rpkid/portal-gui/scripts/rpkigui-sync-users.py
+++ b/rpkid/portal-gui/scripts/rpkigui-sync-users.py
@@ -1,18 +1,24 @@
+# Copyright (C) 2013 SPARTA, Inc. a Parsons Company
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+__version__ = '$Id$'
+
"""
Ensure that a web login exists for labuser* resource holder
"""
-
-import os
-import sys
-
-# if the environment is not already set up, look in the default places
-if not os.getenv("DJANGO_SETTINGS_MODULE"):
- os.environ["DJANGO_SETTINGS_MODULE"] = 'settings'
- for d in ('/etc/rpki', '/usr/local/etc/rpki'):
- if os.path.exists(os.path.join(d, 'settings.py')):
- print 'found settings.py in ' + d
- sys.path.insert(1, d)
- break
+from rpki.gui.script_util import setup
+setup()
from django.contrib.auth.models import User
from rpki.gui.app.models import Conf, ConfACL
diff --git a/rpkid/rpki/gui/script_util.py b/rpkid/rpki/gui/script_util.py
index 4c93ca4e..b98bad88 100644
--- a/rpkid/rpki/gui/script_util.py
+++ b/rpkid/rpki/gui/script_util.py
@@ -1,3 +1,17 @@
+# Copyright (C) 2013 SPARTA, Inc. a Parsons Company
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
"""
This module contains utility functions for use in standalone scripts.
"""