本文整理汇总了Python中server.hierarchy.manager.get_current_customer_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_current_customer_name函数的具体用法?Python get_current_customer_name怎么用?Python get_current_customer_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_customer_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: delete
def delete(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
tag_id = self.arguments.get('id', None)
if tag_id:
tag = TagsManager(username, customer_name, uri, method)
results = tag.remove_tag(tag_id)
else:
results = (
GenericResults(
username, uri, method
).incorrect_arguments()
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('agentids and tag_id', 'delete agents_in_tagid', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:32,代码来源:tag_api.py
示例2: get
def get(self, agent_id):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
count = int(self.get_argument('count', 20))
offset = int(self.get_argument('offset', 0))
sort = self.get_argument('sort', 'desc')
sort_by = self.get_argument('sort_by', OperationKey.CreatedTime)
operations = (
OperationRetriever(
username, customer_name,
uri, method, count, offset,
sort, sort_by
)
)
results = operations.get_all_operations_by_agentid(agent_id)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('operation', 'search by oper type', e)
)
logger.exception(results)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:34,代码来源:transactions_api.py
示例3: delete
def delete(self, notification_id):
username = self.get_current_user().encode('utf-8')
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
notification = (
Notifier(
username, customer_name,
uri, method
)
)
results = (
notification.delete_alerting_rule(notification_id)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('delete notification', 'notifications', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:30,代码来源:notification_handler.py
示例4: get
def get(self, tag_id):
username = self.get_current_user().encode('utf-8')
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
status = self.get_argument('status', 'available')
start_date = self.get_argument('start_date', None)
end_date = self.get_argument('end_date', None)
if start_date:
start_date = int(start_date)
if end_date:
end_date = int(end_date)
results = (
get_os_apps_history_for_tag(
username, customer_name,
uri, method, tag_id, status,
start_date, end_date
)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('customer os stats', 'os stats', e)
)
logger.exception(results)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:35,代码来源:stats_api.py
示例5: get
def get(self):
username = self.get_current_user().encode('utf-8')
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
results = (
get_all_notifications(
username, customer_name,
uri, method
)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('Get list of notifications', 'notifications', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:26,代码来源:notification_handler.py
示例6: get
def get(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri=self.request.uri
method=self.request.method
try:
self.sched = self.application.scheduler
results = job_lister(
sched=self.sched, username=username,
customer_name=customer_name.encode('utf-8'),
uri=uri, method=method
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('getting schedules', '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:28,代码来源:scheduler_api.py
示例7: delete
def delete(self, jobname):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri=self.request.uri
method=self.request.method
try:
self.sched = self.application.scheduler
results = (
remove_job(
self.sched, jobname,
uri=uri,method=method,
customer_name=customer_name,
username=username
)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('delete schedule', '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:30,代码来源:scheduler_api.py
示例8: get
def get(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri=self.request.uri
method=self.request.method
try:
results= None
key=self.get_argument('key')
query=self.get_argument('query')
results = systems_hardware_details(username=username, customer_name=customer_name,
key=key, query=query,
uri=uri, method=method)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('no stats', '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:akaasjager,项目名称:vFense,代码行数:26,代码来源:filter_reports_api.py
示例9: get
def get(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri=self.request.uri
method=self.request.method
try:
results= None
os_code=self.get_argument('os_code', None)
tag_id=self.get_argument('tag_id', None)
results = systems_cpu_details(username=username, customer_name=customer_name,
tag_id=tag_id, os_code=os_code,
uri=uri, method=method
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('no stats', '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:27,代码来源:reports_api.py
示例10: post
def post(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
mouse_name = self.arguments.get('name')
address = self.arguments.get('address')
customers = self.arguments.get('customers', None)
mm = MightyMouse(username, customer_name, uri, method)
results = mm.add(mouse_name, address, customers)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke(agent_id, '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:25,代码来源:relay_servers.py
示例11: put
def put(self, agent_id):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
oper_id = self.arguments.get('operation_id')
error = self.arguments.get('error', None)
success = self.arguments.get('success')
results = (
AddResults(
username, uri, method, agent_id,
oper_id, success, error
)
)
results_data = results.shutdown()
self.set_status(results_data['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(dumps(results_data, indent=4))
send_notifications(username, customer_name, oper_id, agent_id)
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke(agent_id, 'shutdown results', e)
)
logger.exception(results)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:31,代码来源:results.py
示例12: get
def get(self, mouse_name):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
mouse = mouse_exists(mouse_name)
mouse = [mouse]
results = (
GenericResults(
username, uri, method
).information_retrieved(mouse, len(mouse))
)
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke(mouse_name, 'get mouse', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:27,代码来源:relay_servers.py
示例13: post
def post(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
name = self.arguments.get('name', None)
release_date = self.arguments.get('release_date', None)
severity = self.arguments.get('severity', 'Optional')
description = self.arguments.get('description', None)
kb = self.arguments.get('kb', '')
support_url = self.arguments.get('support_url', '')
major_version = self.arguments.get('major_version', None)
minor_version = self.arguments.get('minor_version', None)
vendor_name = self.arguments.get('vendor_name', None)
operating_system = self.arguments.get('operating_system', None)
size = self.arguments.get('size', None)
md5 = self.arguments.get('md5_hash', None)
cli_options = self.arguments.get('cli_options', None)
arch = self.arguments.get('arch', None)
uuid = self.arguments.get('id', None)
result = (
store_package_info_in_db(
username, customer_name, uri, method,
size, md5, operating_system, uuid, name,
severity, arch, major_version, minor_version,
release_date, vendor_name, description,
cli_options, support_url, kb
)
)
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(result, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:33,代码来源:custom_updates_handler.py
示例14: put
def put(self):
username = self.get_current_user().encode('utf-8')
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
app_ids = self.arguments.get('app_ids')
toggle = self.arguments.get('hide', 'toggle')
results = (
update_hidden_status(
username, customer_name, uri,
method, app_ids, toggle,
CustomAppsCollection
)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
logger.exception(e)
results = (
GenericResults(
username, uri, method
).something_broke(app_ids, 'toggle hidden on custom_apps', e)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:31,代码来源:custom_updates_handler.py
示例15: post
def post(self):
passed = False
logged_in = False
username = self.get_current_user()
customer_name = get_current_customer_name(username)
mail_host = self.get_argument('host', None)
mail_user = self.get_argument('user', None)
mail_password = self.get_argument('password', None)
mail_port = self.get_argument('port', 25)
from_email = self.get_argument('from_email', None)
to_email = self.get_arguments('to_email')
is_tls = self.get_argument('is_tls', False)
is_ssl = self.get_argument('is_ssl', False)
if is_tls:
is_tls = return_bool(is_tls)
if is_ssl:
is_ssl = return_bool(is_ssl)
if mail_host and mail_user and mail_password and \
mail_port and from_email and len(to_email) >0:
create_or_modify_mail_config(
modifying_username=username, customer_name=customer_name,
server=mail_host, username=mail_user,
password=mail_password, port=mail_port,
is_tls=is_tls, is_ssl=is_ssl,
from_email=from_email, to_email=to_email
)
mail = MailClient(customer_name)
mail.connect()
if mail.logged_in:
message = '%s - Valid Mail Settings' % (username)
logger.info(message)
result = {
'pass': True,
'message': 'Valid Mail Settings'
}
elif not mail.logged_in:
message = '%s - Incorrect Authentication Settings' % (username)
logger.error(message)
result = {
'pass': False,
'message': 'Incorrect Authentication Settings'
}
elif not mail.connnected:
message = '%s - Invalid Connection Settings' % (username)
logger.error(message)
result = {
'pass': False,
'message': 'Invalid Connection Settings'
}
else:
message = '%s - Incorrect Parameters Passed' % (username)
logger.error(message)
result = {
'pass': False,
'message': 'Incorrect Parameters Passed'
}
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(result, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:58,代码来源:email_api.py
示例16: put
def put(self, agent_id):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
displayname = self.arguments.get('display_name', None)
hostname = self.arguments.get('hostname', None)
prod_level = self.arguments.get('production_level', None)
new_customer = self.arguments.get('customer_name', None)
agent = AgentManager(agent_id, customer_name=customer_name)
if (displayname and not hostname and not
prod_level and not new_customer):
results = agent.displayname_changer(displayname, uri, method)
elif (hostname and not prod_level and not displayname
and not new_customer):
results = agent.hostname_changer(hostname, uri, method)
elif (prod_level and not hostname and not displayname
and not new_customer):
results = agent.production_state_changer(prod_level, uri, method)
elif prod_level and hostname and displayname and not new_customer:
agent_data = {
'host_name': hostname,
'production_level': prod_level,
'display_name': displayname
}
results = agent.update_fields(agent_data, uri, method)
elif (new_customer and not prod_level and not hostname
and not displayname):
results = agent.change_customer(new_customer, uri, method)
else:
results = (
GenericResults(
username, uri, method
).incorrect_arguments()
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke(agent_id, 'modify agent', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:57,代码来源:node_api.py
示例17: get
def get(self, tag_id):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
tag = TagSearcher(username, customer_name, uri, method)
results = tag.get_tag(tag_id)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:10,代码来源:tag_api.py
示例18: get
def get(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
data = {"uuid": gen_uuid()}
results = (
GenericResults(
username, uri, method
).information_retrieved(data, 0)
)
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:13,代码来源:custom_updates_handler.py
示例19: post
def post(self):
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
try:
result = None
sched = self.application.scheduler
uri = self.request.uri
method = self.request.method
operation = self.arguments.get('operation', None)
pkg_type = self.arguments.get('pkg_type', None)
severity = self.arguments.get('severity', None)
jobname = self.arguments.get('jobname', None)
node_ids = self.arguments.get('nodes', None)
tag_ids = self.arguments.get('tags', None)
all_tags=self.arguments.get('all_tags', False)
all_agents=self.arguments.get('all_agents', False)
epoch_time = self.arguments.get('epoch_time')
every = self.arguments.get('every', None)
custom = self.arguments.get('custom', None)
if operation and jobname:
results = (
add_monthly_recurrent(
sched, agent_ids=node_ids,all_agents=all_agents,
all_tags=all_tags,tag_ids=tag_ids, severity=severity,
pkg_type=pkg_type,operation=operation,
name=jobname, epoch_time= epoch_time,
custom = custom, every = every,
customer_name=customer_name,
username=username, uri=uri, method=method
)
)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
except Exception as e:
results = (
GenericResults(
username, uri, method
).something_broke('add monthly recurrent schedule', '', e)
)
logger.exception(e)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:50,代码来源:scheduler_api.py
示例20: put
def put(self, agent_id):
try:
username = self.get_current_user()
customer_name = get_current_customer_name(username)
uri = self.request.uri
method = self.request.method
rebooted = self.arguments.get(AgentKey.Rebooted)
plugins = self.arguments.get(AgentKey.Plugins)
system_info = self.arguments.get(AgentKey.SystemInfo)
hardware = self.arguments.get(AgentKey.Hardware)
logger.info(
'data received on startup: %s' % self.request.body
)
agent_data = (
update_agent(
username, customer_name,
uri, method,
agent_id, system_info,
hardware, rebooted
)
)
agent_data.pop('data')
agent_data['data'] = []
logger.info(agent_data)
self.set_status(agent_data['http_status'])
if agent_data['http_status'] == 200:
if 'rv' in plugins:
RvHandOff(
username, customer_name, uri, method,
agent_id, plugins['rv']['data'],
oper_type='updates_applications'
)
if 'ra' in plugins:
RaHandoff.startup(agent_id, plugins['ra'])
self.set_header('Content-Type', 'application/json')
self.write(dumps(agent_data))
except Exception as e:
status = (
GenericResults(
username, uri, method
).something_broke(agent_id, 'startup', e)
)
logger.exception(status['message'])
self.write(dumps(status))
开发者ID:MiguelMoll,项目名称:vFense,代码行数:49,代码来源:startup.py
注:本文中的server.hierarchy.manager.get_current_customer_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论