Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zmops-test
Project
Overview
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
sanshi
zmops-test
Commits
3379daf9
Commit
3379daf9
authored
Dec 18, 2019
by
sanshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加一个校验
parent
0ba8a764
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
__init__.py
WorkCase/APP/__init__.py
+19
-0
businesses_hosts.py
WorkData/Argus/businesses_hosts.py
+60
-0
No files found.
WorkCase/APP/__init__.py
View file @
3379daf9
...
...
@@ -44,6 +44,7 @@ from WorkApi.APP.HostType.hostType_get import HostTypeGet
from
WorkApi.APP.HostType.hostType_list
import
HostTypeList
from
WorkApi.APP.HostType.hostType_tree
import
HostTypeTree
from
WorkApi.APP.HostType.hostType_update
import
HostTypeUpdate
from
WorkApi.APP.LatestWarning.latestWarning_get
import
LatestWarningGet
from
WorkApi.APP.Members.Get.members_get_role
import
MembersGetRole
from
WorkApi.APP.Members.Update.members_update_info
import
MembersUpdateInfo
from
WorkApi.APP.Members.Update.members_update_status
import
MembersUpdateStatus
...
...
@@ -912,3 +913,21 @@ class AppBase(object):
api
.
hostid
=
hostid
api
.
get_response
()
return
api
.
response
@allure.step
(
"调用接口:latestWarning.get"
)
def
latestWarning_get
(
self
,
token
=
None
,
severity
=
None
,
manageLevel
=
None
,
acknowledged
=
None
,
dateFrom
=
None
,
dateTo
=
None
,
_object
=
None
,
source
=
None
,
alarmRuleid
=
None
,
experienceid
=
None
,
businessid
=
None
):
api
=
LatestWarningGet
(
_host
=
self
.
host
)
api
.
token
=
token
api
.
severity
=
severity
api
.
manageLevel
=
manageLevel
api
.
acknowledged
=
acknowledged
api
.
dateFrom
=
dateFrom
api
.
dateTo
=
dateTo
api
.
object
=
_object
api
.
source
=
source
api
.
alarmRuleid
=
alarmRuleid
api
.
experienceid
=
experienceid
api
.
businessid
=
businessid
api
.
get_response
()
return
api
.
response
WorkData/Argus/businesses_hosts.py
0 → 100644
View file @
3379daf9
# -*- coding: utf_8 -*-
# 表名: businesses_hosts
# 作者: 陈磊
# 时间: 2019-12-18
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy
import
Column
,
Integer
,
VARCHAR
,
SMALLINT
,
DATETIME
,
DECIMAL
,
BigInteger
,
FLOAT
,
NUMERIC
,
TEXT
from
sqlalchemy.orm.exc
import
MultipleResultsFound
,
NoResultFound
from
sqlalchemy
import
or_
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkUtils.UtilsDataBase
import
UtilsDataBase
import
time
Base
=
declarative_base
()
class
BusinessesHosts
(
Base
):
"""
业务资产关系表
"""
__tablename__
=
"businesses_hosts"
id
=
Column
(
BigInteger
,
primary_key
=
True
)
hostid
=
Column
(
BigInteger
,
comment
=
"资产编号"
)
businessesid
=
Column
(
BigInteger
,
comment
=
"业务编号"
)
class
DataBusinessesHosts
(
object
):
def
__init__
(
self
):
self
.
log
=
UtilsLog
()
self
.
log
.
info
(
self
.
__class__
)
self
.
table
=
BusinessesHosts
def
select_all_from_allKeys
(
self
,
session
,
_id
=
None
,
hostid
=
None
,
businessesid
=
None
):
"""
:param session: 指针
:param _id:
:param hostid:
:param businessesid:
:return: 查询结果
"""
self
.
log
.
debug
(
"查询数据库:"
)
try
:
base
=
UtilsDataBase
()
base
.
add_param
(
_key
=
"id"
,
value
=
_id
)
base
.
add_param
(
_key
=
"hostid"
,
value
=
hostid
)
base
.
add_param
(
_key
=
"businessesid"
,
value
=
businessesid
)
sql_rep
=
session
.
query
(
self
.
table
)
.
filter_by
(
**
base
.
param
)
.
all
()
self
.
log
.
debug
(
sql_rep
)
session
.
close
()
return
sql_rep
except
UtilsDataBase
()
.
errors
as
error
:
self
.
log
.
error
(
"异常:"
)
self
.
log
.
error
(
error
)
session
.
close
()
return
error
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