"""
self._start_verbose = verbose
+ self._simulate = False
+
self.data = None
self.json_data = None
self.ref = None
else:
LOG.warn("Wrong verbose level %r, must be >= 0", value)
+ # -----------------------------------------------------------
+ @property
+ def simulate(self):
+ """Flag for simulation mode."""
+ return getattr(self, '_simulate', False)
+
+ @simulate.setter
+ def simulate(self, value):
+ self._simulate = to_bool(value)
+
# -----------------------------------------------------------
@property
def log_directory(self):
res['__class_name__'] = self.__class__.__name__
res['appname'] = self.appname
res['verbose'] = self.verbose
+ res['simulate'] = self.simulate
res['base_dir'] = self.base_dir
res['cgi_bin_dir'] = self.cgi_bin_dir
res['log_directory'] = self.log_directory
)
arg_parser.add_argument(
- "-v", "--verbose",
- action="count",
- dest='verbose',
+ "-v", "--verbose", action="count", dest='verbose',
help='Increase the verbosity level',
)
arg_parser.add_argument(
- "-C", '--cgi',
- action='store_true',
- dest='cgi',
+ '-s', '--simulate', '--test', action='store_true', dest='simulate',
+ help="Simulation mode, nothing is really done.",
+ )
+
+ arg_parser.add_argument(
+ "-C", '--cgi', action='store_true', dest='cgi',
help='Enforces behaviour as called as a CGI script.',
)
arg_parser.add_argument(
- "-h", "--help",
- action='help',
- dest='help',
+ "-h", "--help", action='help', dest='help',
help='Show this help message and exit'
)
arg_parser.add_argument(
- "--usage",
- action='store_true',
- dest='usage',
+ "--usage", action='store_true', dest='usage',
help="Display brief usage message and exit"
)
arg_parser.add_argument(
- "-V", '--version',
- action='version',
+ "-V", '--version', action='version',
version='Version of %(prog)s: {}'.format(self.version),
help="Show program's version number and exit"
)
if not os.environ.get('REQUEST_METHOD', None):
os.environ['REQUEST_METHOD'] = 'GET'
+ if self.cmdline_args.simulate:
+ self.simulate = True
+
# -------------------------------------------------------------------------
def get_cmd(self, cmd):
v=config['verbose'], f=yaml_file, e=e)
LOG.warn(msg)
+ if 'simulate' in config:
+ self.simulate = config['simulate']
+
if 'do_sudo' in config:
self.do_sudo = to_bool(config['do_sudo'])