本文整理汇总了Python中bundlewrap.utils.LOG.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.info方法的具体用法?Python LOG.info怎么用?Python LOG.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bundlewrap.utils.LOG
的用法示例。
在下文中一共展示了LOG.info方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
if self.attributes['running'] is False:
LOG.info(_("{node}:{bundle}:{item}: stopping...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
svc_stop(self.node, self.name)
else:
LOG.info(_("{node}:{bundle}:{item}: starting...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
svc_start(self.node, self.name)
示例2: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
if self.attributes['installed'] is False:
LOG.info(_("{node}:{bundle}:{item}: removing...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
pkg_remove(self.node, self.name)
else:
LOG.info(_("{node}:{bundle}:{item}: installing...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
pkg_install(self.node, self.name)
示例3: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
for fix_type in ('type', 'content', 'mode', 'owner', 'group'):
if fix_type in status.info['needs_fixing']:
if fix_type == 'group' and \
'owner' in status.info['needs_fixing']:
# owner and group are fixed with a single chown
continue
if fix_type in ('mode', 'owner', 'group') and \
'content' in status.info['needs_fixing']:
# fixing content implies settings mode and owner/group
continue
if status.info['path_info'].exists:
if self.attributes['delete']:
LOG.info(_("{node}:{bundle}:{item}: deleting...").format(
bundle=self.bundle.name, node=self.node.name, item=self.id))
else:
LOG.info(_("{node}:{bundle}:{item}: fixing {type}...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
type=fix_type,
))
else:
LOG.info(_("{node}:{bundle}:{item}: creating...").format(
bundle=self.bundle.name, item=self.id, node=self.node.name))
getattr(self, "_fix_" + fix_type)(status)
示例4: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
if 'type' in status.info['needs_fixing']:
# fixing the type fixes everything
if status.info['path_info'].exists:
LOG.info(_("{node}:{bundle}:{item}: fixing type...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
else:
LOG.info(_("{node}:{bundle}:{item}: creating...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
self._fix_type(status)
return
for fix_type in ('owner', 'group', 'target'):
if fix_type in status.info['needs_fixing']:
if fix_type == 'group' and \
'owner' in status.info['needs_fixing']:
# owner and group are fixed with a single chown
continue
LOG.info(_("{node}:{item}: fixing {type}...").format(
item=self.id,
node=self.node.name,
type=fix_type,
))
getattr(self, "_fix_" + fix_type)(status)
示例5: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
if not status.info['exists']:
LOG.info(_("{node}:{bundle}:{item}: creating...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
if self.attributes['gid'] is None:
command = "groupadd {}".format(self.name)
else:
command = "groupadd -g {gid} {groupname}".format(
gid=self.attributes['gid'],
groupname=self.name,
)
self.node.run(command, may_fail=True)
elif self.attributes['delete']:
LOG.info(_("{node}:{bundle}:{item}: deleting...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
self.node.run("groupdel {}".format(self.name), may_fail=True)
else:
LOG.info(_("{node}:{bundle}:{item}: updating...").format(
bundle=self.bundle.name,
item=self.id,
node=self.node.name,
))
self.node.run(
"groupmod -g {gid} {groupname}".format(
gid=self.attributes['gid'],
groupname=self.name,
),
may_fail=True,
)
示例6: fix
# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import info [as 别名]
def fix(self, status):
if status.info['exists']:
if self.attributes['delete']:
msg = _("{node}:{bundle}:{item}: deleting...")
else:
msg = _("{node}:{bundle}:{item}: updating...")
else:
msg = _("{node}:{bundle}:{item}: creating...")
LOG.info(msg.format(bundle=self.bundle.name, item=self.id, node=self.node.name))
if self.attributes['delete']:
self.node.run("userdel {}".format(self.name), may_fail=True)
else:
command = "useradd " if not status.info['exists'] else "usermod "
for attr, option in sorted(_ATTRIBUTE_OPTIONS.items()):
if attr in status.info['needs_fixing'] and self.attributes[attr] is not None:
if attr == 'groups':
value = ",".join(self.attributes[attr])
else:
value = str(self.attributes[attr])
command += "{} {} ".format(option, quote(value))
command += self.name
self.node.run(command, may_fail=True)