Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
a320b9e0
Commit
a320b9e0
authored
Apr 07, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 兼容py3
parent
b913bce3
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
21 additions
and
24 deletions
+21
-24
_asset_import_modal.html
apps/assets/templates/assets/_asset_import_modal.html
+0
-1
asset_group_create.html
apps/assets/templates/assets/asset_group_create.html
+8
-5
asset.py
apps/assets/views/asset.py
+2
-2
mixins.py
apps/common/mixins.py
+0
-2
utils.py
apps/common/utils.py
+4
-4
settings.py
apps/jumpserver/settings.py
+1
-0
runner.py
apps/ops/ansible/runner.py
+0
-4
utils.py
apps/users/utils.py
+4
-4
user.py
apps/users/views/user.py
+0
-1
mac_requirements.py
requirements/mac_requirements.py
+0
-0
mac_requirements.txt
requirements/mac_requirements.txt
+1
-0
run_server.py
run_server.py
+1
-1
No files found.
apps/assets/templates/assets/_asset_import_modal.html
View file @
a320b9e0
...
...
@@ -3,7 +3,6 @@
{% block modal_id %}asset_import_modal{% endblock %}
{% block modal_title%}{% trans "Import asset" %}{% endblock %}
{% block modal_body %}
<p
class=
"text-success"
>
{% trans "Download template or use export excel format" %}
</p>
<form
method=
"post"
action=
"{% url 'assets:asset-import' %}"
id=
"fm_asset_import"
enctype=
"multipart/form-data"
>
{% csrf_token %}
<div
class=
"form-group"
>
...
...
apps/assets/templates/assets/asset_group_create.html
View file @
a320b9e0
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load bootstrap %}
{% load bootstrap3 %}
{#{% load bootstrap %}#}
{% block custom_head_css_js %}
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
...
...
@@ -34,13 +35,15 @@
<form
id=
"groupForm"
method=
"post"
class=
"form-horizontal"
>
{% csrf_token %}
<h3
class=
"widget-head-color-box"
>
资产组信息
</h3>
{{ form.name|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
{% bootstrap_field form.name layout="horizontal" %}
{% bootstrap_field form.comment layout="horizontal" %}
{# {{ form.name|bootstrap_horizontal }}#}
{# {{ form.comment|bootstrap_horizontal }}#}
<div
class=
"hr-line-dashed"
></div>
<h3
class=
"widget-head-color-box"
>
用户选择的资产
</h3>
<div
class=
"form-group"
>
<label
class=
"col-sm-
2
control-label"
id=
"asset_on_count"
>
已选({{ assets_count }})
</label>
<div
class=
"col-sm-
9
"
id=
"asset_sed"
>
<label
class=
"col-sm-
3
control-label"
id=
"asset_on_count"
>
已选({{ assets_count }})
</label>
<div
class=
"col-sm-
8
"
id=
"asset_sed"
>
<div
class=
"form-asset-on"
id=
"add_asset"
>
<p
id=
"asset_on_p"
>
{% for asset in assets_on_list %}
...
...
apps/assets/views/asset.py
View file @
a320b9e0
...
...
@@ -209,7 +209,7 @@ class AssetExportView(View):
@staticmethod
def
get_asset_attr
(
asset
,
attr
):
if
attr
in
[
'admin_user'
,
'idc'
]:
return
getattr
(
asset
,
attr
)
.
name
return
getattr
(
asset
,
attr
)
elif
attr
in
[
'status'
,
'type'
,
'env'
]:
return
getattr
(
asset
,
'get_{}_display'
.
format
(
attr
))()
else
:
...
...
@@ -225,7 +225,7 @@ class AssetExportView(View):
wb
=
Workbook
()
ws
=
wb
.
active
ws
.
title
=
'Asset'
header
=
[
'hostname'
,
'ip'
,
'port'
,
'admin_user'
,
'idc'
,
'
cpu'
,
'
memory'
,
'disk'
,
header
=
[
'hostname'
,
'ip'
,
'port'
,
'admin_user'
,
'idc'
,
'memory'
,
'disk'
,
'mac_address'
,
'other_ip'
,
'remote_card_ip'
,
'os'
,
'cabinet_no'
,
'cabinet_pos'
,
'number'
,
'status'
,
'type'
,
'env'
,
'sn'
,
'comment'
]
ws
.
append
(
header
)
...
...
apps/common/mixins.py
View file @
a320b9e0
...
...
@@ -47,7 +47,6 @@ class JSONResponseMixin(object):
class
IDInFilterMixin
(
object
):
def
filter_queryset
(
self
,
queryset
):
id_list
=
self
.
request
.
query_params
.
get
(
'id__in'
)
if
id_list
:
...
...
@@ -55,7 +54,6 @@ class IDInFilterMixin(object):
try
:
ids
=
json
.
loads
(
id_list
)
except
Exception
as
e
:
print
e
return
queryset
if
isinstance
(
ids
,
list
):
queryset
=
queryset
.
filter
(
id__in
=
ids
)
...
...
apps/common/utils.py
View file @
a320b9e0
...
...
@@ -26,9 +26,9 @@ from django.conf import settings
from
django.utils
import
timezone
try
:
import
cStringIO
as
StringIO
from
io
import
StringIO
except
ImportError
:
import
StringIO
from
StringIO
import
StringIO
from
.compat
import
to_bytes
,
to_string
...
...
@@ -183,7 +183,7 @@ def timesince(dt, since='', default="just now"):
def
ssh_key_string_to_obj
(
text
):
key_f
=
StringIO
.
StringIO
(
text
)
key_f
=
StringIO
(
text
)
key
=
None
try
:
key
=
paramiko
.
RSAKey
.
from_private_key
(
key_f
)
...
...
@@ -223,7 +223,7 @@ def ssh_key_gen(length=2048, type='rsa', password=None, username='jumpserver', h
if
hostname
is
None
:
hostname
=
os
.
uname
()[
1
]
f
=
StringIO
.
StringIO
()
f
=
StringIO
()
try
:
if
type
==
'rsa'
:
...
...
apps/jumpserver/settings.py
View file @
a320b9e0
...
...
@@ -60,6 +60,7 @@ INSTALLED_APPS = [
'applications.apps.ApplicationsConfig'
,
'rest_framework'
,
'bootstrapform'
,
'bootstrap3'
,
'captcha'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
...
...
apps/ops/ansible/runner.py
View file @
a320b9e0
...
...
@@ -26,10 +26,6 @@ C.HOST_KEY_CHECKING = False
logger
=
get_logger
(
__name__
)
class
AnsibleError
(
StandardError
):
pass
# Jumpserver not use playbook
class
PlayBookRunner
(
object
):
"""
...
...
apps/users/utils.py
View file @
a320b9e0
...
...
@@ -17,10 +17,10 @@ from common.utils import reverse, get_object_or_none
from
.models
import
User
try
:
import
cStringIO
as
StringIO
except
ImportError
:
import
StringIO
#
try:
# from io import
StringIO
#
except ImportError:
# from StringIO
import StringIO
logger
=
logging
.
getLogger
(
'jumpserver'
)
...
...
apps/users/views/user.py
View file @
a320b9e0
...
...
@@ -171,7 +171,6 @@ class UserBulkImportView(AdminUserRequiredMixin, JSONResponseMixin, FormView):
try
:
error
=
form
.
errors
.
values
()[
-
1
][
-
1
]
except
Exception
as
e
:
print
e
error
=
_
(
'Invalid file.'
)
data
=
{
'success'
:
False
,
...
...
requirements/mac_requirements.py
deleted
100644 → 0
View file @
b913bce3
requirements/mac_requirements.txt
0 → 100644
View file @
a320b9e0
openssl brew install libtiff libjpeg webp little-cms2
run_server.py
View file @
a320b9e0
...
...
@@ -23,7 +23,7 @@ def start_django():
http_port
=
CONFIG
.
HTTP_LISTEN_PORT
or
'8080'
os
.
chdir
(
apps_dir
)
print
(
'start django'
)
subprocess
.
call
(
'python
2.7
./manage.py runserver
%
s:
%
s'
%
(
http_host
,
http_port
),
shell
=
True
)
subprocess
.
call
(
'python ./manage.py runserver
%
s:
%
s'
%
(
http_host
,
http_port
),
shell
=
True
)
def
start_celery
():
...
...
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