remove datetime from config to wrong position

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-06 20:20:35 +02:00
parent 84867db20a
commit 13d47f3cf4
2 changed files with 12 additions and 10 deletions

View file

@ -21,6 +21,7 @@
# #
import argparse import argparse
import datetime
import logging import logging
import os import os
import re import re
@ -105,6 +106,8 @@ if __name__ == "__main__":
try: try:
logging.basicConfig(format='%(levelname)s: %(message)s') logging.basicConfig(format='%(levelname)s: %(message)s')
time_start = datetime.datetime.now()
if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])):
import cdist.emulator import cdist.emulator
cdist.emulator.run(sys.argv) cdist.emulator.run(sys.argv)
@ -117,6 +120,14 @@ if __name__ == "__main__":
import cdist.path import cdist.path
commandline() commandline()
time_end = datetime.datetime.now()
duration = time_end - time_start
# FIXME: move into runner
# log.info("Finished run of %s in %s seconds", self.target_host,
# duration.total_seconds())
log.info("Finished run in %s seconds", duration.total_seconds())
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(0) sys.exit(0)
except cdist.Error as e: except cdist.Error as e:

View file

@ -234,22 +234,13 @@ class ConfigInstall:
self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="gencode")
self.object_run(cdist_object, mode="code") self.object_run(cdist_object, mode="code")
### Cleaned / check functions: Round 1 :-) #################################
def deploy_to(self): def deploy_to(self):
"""Mimic the old deploy to: Deploy to one host""" """Mimic the old deploy to: Deploy to one host"""
log.info("Deploying to " + self.target_host) log.info("Deploying to " + self.target_host)
time_start = datetime.datetime.now()
self.stage_prepare() self.stage_prepare()
self.stage_run() self.stage_run()
time_end = datetime.datetime.now()
duration = time_end - time_start
log.info("Finished run of %s in %s seconds",
self.target_host,
duration.total_seconds())
### Cleaned / check functions: Round 1 :-) #################################
def deploy_and_cleanup(self): def deploy_and_cleanup(self):
"""Do what is most often done: deploy & cleanup""" """Do what is most often done: deploy & cleanup"""
self.deploy_to() self.deploy_to()