mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-04-26 07:55:52 +03:00
[GH-ISSUE #191] NwFilter load templates problem #127
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/webvirtcloud#127
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ssbaksa on GitHub (Sep 28, 2018).
Original GitHub issue: https://github.com/retspen/webvirtcloud/issues/191
NwFilter templates problem. Somehow, templates have been lost from directory.
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
Environment:
Request Method: GET
Request URL: http://172.17.252.168:80/compute/2/nwfilters/
Django Version: 1.11.14
Python Version: 2.7.12
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'computes',
'console',
'networks',
'storages',
'interfaces',
'instances',
'secrets',
'logs',
'accounts',
'create',
'datasource')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Template loader postmortem
Django tried loading these templates, in this order:
Using engine django:
* django.template.loaders.filesystem.Loader: /srv/webvirtcloud/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/contrib/admin/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/contrib/auth/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/computes/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/console/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/networks/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/storages/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/interfaces/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/instances/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/secrets/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/logs/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/accounts/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/create/templates/nwfilters.html (Source does not exist)
* django.template.loaders.app_directories.Loader: /srv/webvirtcloud/datasource/templates/nwfilters.html (Source does not exist)
Traceback:
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "/srv/webvirtcloud/nwfilters/views.py" in nwfilters
113. 'compute': compute})
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context, request, using=using)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
67. template = get_template(template_name, using=using)
File "/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/template/loader.py" in get_template
25. raise TemplateDoesNotExist(template_name, chain=chain)
Exception Type: TemplateDoesNotExist at /compute/2/nwfilters/
Exception Value: nwfilters.html
@catborise commented on GitHub (Sep 28, 2018):
hi, does nwfilter and nwfilters.html exist in /srv/webvirtcloud/nwtfilters/templates/ directory?
@catborise commented on GitHub (Sep 28, 2018):
@honza801 @ssbaksa could you try/test my new branch comp_instances?
(https://github.com/catborise/webvirtcloud/tree/comp_instances)
thanks
@ssbaksa commented on GitHub (Sep 28, 2018):
No. I have seen those files before but now it is almost empty.
root@suncica8:/srv/webvirtcloud/nwfilters/templates# ll
total 36
drwxr-xr-x 2 www-data www-data 4096 Sep 26 10:04 ./
drwxr-xr-x 4 www-data www-data 4096 Sep 26 10:06 ../
-rw-r--r-- 1 www-data www-data 1699 Sep 26 10:04 create_nwfilter_block.html
-rw-r--r-- 1 www-data www-data 9855 Sep 26 10:04 nwfilter.html
-rw-r--r-- 1 www-data www-data 9524 Sep 26 10:04 nwfilters.html
On Fri, 28 Sep 2018 at 12:57, catborise notifications@github.com wrote:
@catborise commented on GitHub (Sep 28, 2018):
app cannot remove itself. may be git or something breaks... git pull/checkout again.
@ssbaksa commented on GitHub (Sep 28, 2018):
Hi,
Something have "gone south"
After latest pull
(venv) root@suncica8:/srv/webvirtcloud# python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/init.py",
line 364, in execute_from_command_line
utility.execute()
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/init.py",
line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 283, in run_from_argv
self.execute(*args, **cmd_options)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 327, in execute
self.check()
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 359, in check
include_deployment_checks=include_deployment_checks,
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
line 62, in _run_checks
issues.extend(super(Command, self)._run_checks(**kwargs))
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 346, in _run_checks
return checks.run_checks(**kwargs)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/checks/registry.py",
line 81, in run_checks
new_errors = check(app_configs=app_configs)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/checks/urls.py",
line 16, in check_url_config
return check_resolver(resolver)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/core/checks/urls.py",
line 26, in check_resolver
return check_method()
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/urls/resolvers.py",
line 254, in check
for pattern in self.url_patterns:
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/utils/functional.py",
line 35, in get
res = instance.dict[self.name] = self.func(instance)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/urls/resolvers.py",
line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/utils/functional.py",
line 35, in get
res = instance.dict[self.name] = self.func(instance)
File
"/srv/webvirtcloud/venv/local/lib/python2.7/site-packages/django/urls/resolvers.py",
line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/srv/webvirtcloud/webvirtcloud/urls.py", line 3, in
from instances.views import instances, instance, index
File "/srv/webvirtcloud/instances/views.py", line 20, in
from vrtManager.instance import wvmInstance, wvmInstances
File "/srv/webvirtcloud/vrtManager/instance.py", line 11, in
from vrtManager.storage import wvmStorage
File "/srv/webvirtcloud/vrtManager/storage.py", line 3, in
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
ImportError: cannot import name INSTANCE_VOLUME_DEFAULT_OWNER
On Fri, 28 Sep 2018 at 13:00, catborise notifications@github.com wrote:
@catborise commented on GitHub (Sep 28, 2018):
after update operation. you should always chech settings.py and settings.py.template
if there is a new options in settings. you should copy it to your settings.py file.
as you see last lines of logs it explains that webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER operation failed because settings.py file does not contain INSTANCE_VOLUME_DEFAULT_OWNER.
add INSTANCE_VOLUME_DEFAULT_OWNER = {'uid': 0, 'guid': 0} to settings.py
@ssbaksa commented on GitHub (Sep 28, 2018):
Ah, yes, stupid me. I was in the middle of two different task and then
decided to squeeze in your change end test it.
Will try it again.
On Fri, 28 Sep 2018 at 13:35, catborise notifications@github.com wrote:
@ssbaksa commented on GitHub (Sep 28, 2018):
Well ... Still no rules. I have spare GIT on windows laptop which function
just to check various commit's. Also no rules there.
root@suncica8:/srv/webvirtcloud# git checkout
Your branch is up-to-date with 'origin/master'.
root@suncica8:/srv/webvirtcloud# ll nwfilters/
admin.py apps.py init.py init.pyc migrations/
models.py templates/ tests.py views.py views.pyc
root@suncica8:/srv/webvirtcloud# ll nwfilters/templates/
total 36
drwxr-xr-x 2 www-data www-data 4096 Sep 28 13:36 ./
drwxr-xr-x 4 www-data www-data 4096 Sep 28 13:36 ../
-rw-r--r-- 1 root root 1699 Sep 28 13:36 create_nwfilter_block.html
-rw-r--r-- 1 root root 9855 Sep 28 13:36 nwfilter.html
-rw-r--r-- 1 root root 9524 Sep 28 13:36 nwfilters.html
root@suncica8:/srv/webvirtcloud# git reflog
e44e01cHEAD@{0}: pull: Fast-forwardb916c9dHEAD@{1}: reset: moving to HEAD@{1}e44e01cHEAD@{2}: pull: Fast-forwardb916c9dHEAD@{3}: pull: Fast-forward4d14fdcHEAD@{4}: pull: Fast-forward0d90e4bHEAD@{5}: pull: Fast-forwardbe6c1e9HEAD@{6}: clone: from https://github.com/catborise/webvirtcloud.gitOn Fri, 28 Sep 2018 at 13:17, catborise notifications@github.com wrote:
@ssbaksa commented on GitHub (Sep 28, 2018):
Yup! True! it works now with line added.
I will continue testing this evening. Must go for now. Please, send me your
requests or suggestions.
Br
Sasa
On Fri, 28 Sep 2018 at 13:41, Saša-Stjepan Bakša ssbaksa@gmail.com wrote:
@catborise commented on GitHub (Sep 28, 2018):
if it works as expected. i will create a pull request to merges retspen/master.
thanks.
have a nice day.
@ssbaksa commented on GitHub (Nov 8, 2018):
I have found what's wrong with nwfilters tab.
It is similar problem as problem with adding INSTANCE_VOLUME_DEFAULT_OWNER = {'uid': 0, 'guid': 0} to settings.py
In settings. py there is a missing line with nwfilters. It can be found in settings.py.template.
Manualy edit list in settings py to look like this and all will works as expected.
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'computes',
'console',
'networks',
'storages',
'interfaces',
'nwfilters',
'instances',
'secrets',
'logs',
'accounts',
'create',
'datasource',
)
Maybe it will be good idea to warn users after running python manage.py migrate that there is difference in settings.py VS settings.py.template which should be reviewed manualy to have working WebVirtCloud instance.
Br
Sasa