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 datetime
import logging
import os
import re
@ -105,6 +106,8 @@ if __name__ == "__main__":
try:
logging.basicConfig(format='%(levelname)s: %(message)s')
time_start = datetime.datetime.now()
if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])):
import cdist.emulator
cdist.emulator.run(sys.argv)
@ -117,6 +120,14 @@ if __name__ == "__main__":
import cdist.path
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:
sys.exit(0)
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="code")
### Cleaned / check functions: Round 1 :-) #################################
def deploy_to(self):
"""Mimic the old deploy to: Deploy to one host"""
log.info("Deploying to " + self.target_host)
time_start = datetime.datetime.now()
self.stage_prepare()
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):
"""Do what is most often done: deploy & cleanup"""
self.deploy_to()