from .app import PpApplication
-__version__ = '0.5.1'
+__version__ = '0.5.2'
LOG = logging.getLogger(__name__)
'errors': 'surrogateescape',
}
+ dev_null = os.sep + os.path.join('dev', 'null')
+
# -------------------------------------------------------------------------
def __init__(
self, appname=None, verbose=0, version=__version__, base_dir=None,
self.modules = {}
self.dependencies = []
self.rev_dep = {}
+ self.no_write = False
super(CheckPuppetEnvApp, self).__init__(
appname=appname, verbose=verbose, version=version, base_dir=base_dir,
"""
res = super(CheckPuppetEnvApp, self).as_dict(short=short)
+ res['dev_null'] = self.dev_null
res['open_args'] = self.open_args
return res
os.path.join(self.base_dir, 'tmp'))
)
+ self.arg_parser.add_argument(
+ '-N', '--no-write', action="store_true", dest="no_write",
+ help="Do not generate output files.",
+ )
+
# -------------------------------------------------------------------------
def perform_arg_parser(self):
+ if self.args.no_write:
+ self.no_write = True
+
puppet_root_env_dir = self.puppet_root_env_dir
retval = 5
out_file = os.path.join(self.out_dir, outfile_base)
LOG.info("Writing information about modules in {!r}...".format(out_file))
+ if self.no_write:
+ LOG.debug("Don't writing into {!r}...".format(out_file))
+ if self.verbose:
+ print()
+ print("Module information:")
+ print()
+ print('---')
+ print(yaml.dump(self.modules, width=240))
+ print()
+ return
with open(out_file, 'w', **self.open_args) as fh:
+ fh.write('---\n')
fh.write(yaml.dump(self.modules, width=240))
# -------------------------------------------------------------------------
print(line)
fh.write(line + '\n')
+ if self.no_write:
+ LOG.debug("Don't writing into {!r}...".format(out_file))
+ out_file = self.dev_null
+
with open(out_file, 'w', **self.open_args) as fh:
# File header