set reading /proc/uptime to false by default.
reading /proc/uptime is going to be slower, and no reason to do it on most things. Better to only do it when you suspect maybe a need for it.
This commit is contained in:
@@ -503,9 +503,8 @@ def main():
|
|||||||
|
|
||||||
(name, functor) = args.action
|
(name, functor) = args.action
|
||||||
|
|
||||||
return util.log_time(logfunc=LOG.debug,
|
return util.log_time(logfunc=LOG.debug, msg="cloud-init mode '%s'" % name,
|
||||||
msg="cloud-init mode '%s'" % name, uptime=True,
|
get_uptime=True, func=functor, args=(name, args))
|
||||||
func=functor, args=(name, args))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ def apply_hostname_bounce(hostname, policy, interface, command,
|
|||||||
shell = not isinstance(command, (list, tuple))
|
shell = not isinstance(command, (list, tuple))
|
||||||
# capture=False, see comments in bug 1202758 and bug 1206164.
|
# capture=False, see comments in bug 1202758 and bug 1206164.
|
||||||
util.log_time(logfunc=LOG.debug, msg="publishing hostname",
|
util.log_time(logfunc=LOG.debug, msg="publishing hostname",
|
||||||
func=util.subp, kwargs={'command': command, 'shell': shell,
|
get_uptime=True, func=util.subp,
|
||||||
'capture': False, 'env': env})
|
kwargs={'command': command, 'shell': shell, 'capture': False,
|
||||||
|
'env': env})
|
||||||
|
|
||||||
|
|
||||||
def crtfile_to_pubkey(fname):
|
def crtfile_to_pubkey(fname):
|
||||||
|
|||||||
@@ -1772,7 +1772,7 @@ def which(program):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def log_time(logfunc, msg, func, args=None, kwargs=None, get_uptime=True):
|
def log_time(logfunc, msg, func, args=None, kwargs=None, get_uptime=False):
|
||||||
if args is None:
|
if args is None:
|
||||||
args = []
|
args = []
|
||||||
if kwargs is None:
|
if kwargs is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user