本文整理汇总了Python中vFense.core.user.users.get_user_property函数的典型用法代码示例。如果您正苦于以下问题:Python get_user_property函数的具体用法?Python get_user_property怎么用?Python get_user_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_property函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get
def get(self):
username = self.get_current_user().encode('utf-8')
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
os_code = self.get_argument('os_code', None)
os_string = self.get_argument('os_string', None)
if not os_code and not os_string or os_code and not os_string:
data = get_supported_os_codes()
elif os_string:
data = get_supported_os_strings(customer_name)
results = (
GenericResults(
username, uri, method
).information_retrieved(data, len(data))
)
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 OS Codes', '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:akaasjager,项目名称:vFense,代码行数:35,代码来源:agent.py
示例2: delete
def delete(self, agent_id):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
agent = AgentManager(agent_id, customer_name=customer_name)
delete_oper = StorePatchingOperation(username, customer_name, uri, method)
delete_oper.uninstall_agent(agent_id)
results = agent.delete_agent(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(agent_id, 'delete 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:akaasjager,项目名称:vFense,代码行数:26,代码来源:agent.py
示例3: put
def put(self, agent_id):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
operation_id = self.arguments.get('operation_id')
error = self.arguments.get('error', None)
success = self.arguments.get('success')
results = (
AgentOperationResults(
username, agent_id, operation_id,
success, error, uri, method
)
)
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, operation_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:akaasjager,项目名称:vFense,代码行数:33,代码来源:results.py
示例4: get
def get(self):
username = self.get_current_user().encode('utf-8')
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
app_stats = (
get_all_app_stats_by_customer(customer_name)
)
results = (
GenericResults(
username, uri, method
).information_retrieved(app_stats)
)
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('widget handler', 'widgets', 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:akaasjager,项目名称:vFense,代码行数:29,代码来源:stats_api.py
示例5: delete
def delete(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
mouse_names = self.arguments.get('names')
mm = MightyMouse(username, customer_name, uri, method)
for mouse in mouse_names:
results = mm.remove(mouse_name)
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, 'delete 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:akaasjager,项目名称:vFense,代码行数:26,代码来源:relay_servers.py
示例6: post
def post(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:27,代码来源:relay_servers.py
示例7: get
def get(self, mouse_name):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:29,代码来源:relay_servers.py
示例8: delete
def delete(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:34,代码来源:tag_api.py
示例9: put
def put(self, agent_id):
try:
username = self.get_current_user()
customer_name = get_user_property(username, UserKeys.CurrentCustomer)
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(agent_id, system_info, hardware, rebooted, username, customer_name, uri, method)
uris = get_result_uris(agent_id, username, uri, method)
uris[AgentOperationKey.Operation] = AgentOperations.REFRESH_RESPONSE_URIS
agent_data.pop("data")
agent_data["data"] = [uris]
self.set_status(agent_data["http_status"])
if agent_data["http_status"] == 200:
if "rv" in plugins:
RvHandOff(username, customer_name, uri, method).startup_operation(agent_id, plugins["rv"]["data"])
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:ttysteale,项目名称:vFense,代码行数:33,代码来源:startup.py
示例10: get
def get(self):
username = self.get_current_user().encode('utf-8')
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:28,代码来源:notification_handler.py
示例11: get
def get(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
query = self.get_argument('query', None)
count = int(self.get_argument('count', 30))
offset = int(self.get_argument('offset', 0))
uri = self.request.uri
method = self.request.method
sort = self.get_argument('sort', 'asc')
sort_by = self.get_argument('sort_by', TagsKey.TagName)
tag = (
TagSearcher(
username, customer_name, uri, method,
count, offset, sort, sort_by
)
)
if not query:
results = tag.get_all()
else:
results = tag.search_by_name(query)
self.set_status(results['http_status'])
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(results, indent=4))
开发者ID:akaasjager,项目名称:vFense,代码行数:26,代码来源:tag_api.py
示例12: get
def get(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:29,代码来源:reports_api.py
示例13: get
def get(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri = self.request.uri
method = self.request.method
try:
count = (
int(
self.get_argument(ApiArguments.COUNT,
DefaultQueryValues.COUNT
)
)
)
offset = (
int(
self.get_argument(
ApiArguments.OFFSET,
DefaultQueryValues.OFFSET
)
)
)
sort = self.get_argument(ApiArguments.SORT, SortValues.DESC)
sort_by = (
self.get_argument(
ApiArguments.SORT_BY,
AgentOperationKey.CreatedTime
)
)
operation = self.get_argument(ApiArguments.OPERATION, None)
operations = (
AgentOperationRetriever(
customer_name,
count, offset, sort, sort_by,
username, uri, method
)
)
if operation:
results = operations.get_all_by_operation(operation)
else:
results = operations.get_all()
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:akaasjager,项目名称:vFense,代码行数:60,代码来源:agent_operations.py
示例14: post
def post(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:35,代码来源:custom_updates_handler.py
示例15: delete
def delete(self, jobname):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:32,代码来源:scheduler_api.py
示例16: get
def get(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:30,代码来源:scheduler_api.py
示例17: put
def put(self, agent_id):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:59,代码来源:agent.py
示例18: post
def post(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
uri=self.request.uri
method=self.request.method
try:
result = None
sched = self.application.scheduler
operation = self.arguments.get('operation')
pkg_type = self.arguments.get('pkg_type')
severity = self.arguments.get('severity')
jobname = self.arguments.get('jobname')
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_yearly_recurrent(
sched,
customer_name=customer_name,
username=username,
agent_ids=node_ids,
all_agents=all_agents,
tag_ids=tag_ids,
all_tags=all_tags,
severity=severity,
pkg_type=pkg_type,
operation=operation,
name=jobname,
every = every,
custom = custom,
epoch_time= epoch_time,
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 yearly 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:akaasjager,项目名称:vFense,代码行数:59,代码来源:scheduler_api.py
示例19: post
def post(self):
username = self.get_current_user()
customer_name = (
get_user_property(username, UserKeys.CurrentCustomer)
)
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:akaasjager,项目名称:vFense,代码行数:58,代码来源:email_api.py
示例20: post
def post(self):
current_user = self.get_current_user()
customer_name = get_user_property(current_user, UserKeys.CurrentCustomer)
body = json.loads(self.request.body)
password = body.get("password")
results = ra_settings.save_rd_password(password=password, user=current_user, customer=current_customer)
self.set_header("Content-Type", "application/json")
self.write(json.dumps(results, indent=4))
开发者ID:ttysteale,项目名称:vFense,代码行数:11,代码来源:settings.py
注:本文中的vFense.core.user.users.get_user_property函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论