Commit 1bc88e5b authored by Administrator's avatar Administrator

Merge branch 'ansible_api' into ops_dev

# Conflicts:
#	apps/jumpserver/urls.py
#	apps/locale/zh/LC_MESSAGES/django.po
#	apps/templates/_nav.html
#	requirements.txt
#	run_server.py
parent c289d6a4
from rest_framework.routers import DefaultRouter
from ops.api import views as ops_api_view
router = DefaultRouter()
router.register(r'host_alia', ops_api_view.HostAliaViewSet)
router.register(r'user_alia', ops_api_view.UserAliaViewSet)
router.register(r'cmd_alia', ops_api_view.CmdAliaViewSet)
router.register(r'runas_alia', ops_api_view.RunasAliaViewSet)
router.register(r'extra_conf', ops_api_view.ExtraconfViewSet)
router.register(r'privilege', ops_api_view.PrivilegeViewSet)
router.register(r'sudo', ops_api_view.SudoViewSet)
router.register(r'cron', ops_api_view.CronTableViewSet)
\ No newline at end of file
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
"""jumpserver URL Configuration """jumpserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see: The `urlpatterns` list routes URLs to views. For more information please see:
...@@ -17,12 +20,12 @@ from django.conf.urls import url, include ...@@ -17,12 +20,12 @@ from django.conf.urls import url, include
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from jumpserver.api_router import router
urlpatterns = [ urlpatterns = [
url(r'^captcha/', include('captcha.urls')), url(r'^captcha/', include('captcha.urls')),
url(r'^$', TemplateView.as_view(template_name='base.html'), name='index'), url(r'^$', TemplateView.as_view(template_name='base.html'), name='index'),
url(r'^users/', include('users.urls.views_urls', namespace='users')), url(r'^users/', include('users.urls.views_urls', namespace='users')),
url(r'^assets/', include('assets.urls.views_urls', namespace='assets')), url(r'^assets/', include('assets.urls.views_urls', namespace='assets')),
url(r'^perms/', include('perms.urls.views_urls', namespace='perms')), url(r'^perms/', include('perms.urls.views_urls', namespace='perms')),
...@@ -33,13 +36,14 @@ urlpatterns = [ ...@@ -33,13 +36,14 @@ urlpatterns = [
url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')), url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')),
url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')), url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')),
url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')), url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')),
url(r'^(api/)?users/', include('users.urls')),
url(r'^assets/', include('assets.urls')),
url(r'^perms/', include('perms.urls')),
url(r'^(api/)?ops/', include('ops.urls')),
] ]
urlpatterns += [
url(r'^api/v1/ops', include(router.urls)),
]
if settings.DEBUG: if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# ~*~ coding: utf-8 ~*~ # ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals from __future__ import unicode_literals
from rest_framework.routers import DefaultRouter
from django.conf.urls import url, include
from django.conf.urls import url
from api import views as api_view
import views as page_view import views as page_view
app_name = 'ops' app_name = 'ops'
router = DefaultRouter()
router.register(r'host_alia', api_view.HostAliaViewSet)
router.register(r'user_alia', api_view.UserAliaViewSet)
router.register(r'cmd_alia', api_view.CmdAliaViewSet)
router.register(r'runas_alia', api_view.RunasAliaViewSet)
router.register(r'extra_conf', api_view.ExtraconfViewSet)
router.register(r'privilege', api_view.PrivilegeViewSet)
router.register(r'sudo', api_view.SudoViewSet)
router.register(r'cron', api_view.CronTableViewSet)
urlpatterns = [ urlpatterns = [
# Resource Sudo url # Resource Sudo url
...@@ -35,8 +23,5 @@ urlpatterns = [ ...@@ -35,8 +23,5 @@ urlpatterns = [
url(r'^cron/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'), url(r'^cron/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'),
] ]
urlpatterns += [
url(r'^v1/sudo', include(router.urls)),
]
...@@ -30,7 +30,7 @@ def start_celery(): ...@@ -30,7 +30,7 @@ def start_celery():
os.chdir(apps_dir) os.chdir(apps_dir)
os.environ.setdefault('C_FORCE_ROOT', '1') os.environ.setdefault('C_FORCE_ROOT', '1')
print('start celery') print('start celery')
subprocess.call('celery -A common worker -P eventlet -B -s /tmp/celerybeat-schedule -l info ', shell=True) subprocess.call('celery -A common worker -P eventlet -s /tmp/celerybeat-schedule -l info ', shell=True)
def main(): def main():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment