def test_dummyLogger(): log._logger = log._dummyLogger() log.debug('') log.error('') log.warn('') log.info('') log.msg('')
def _verify(envfn): rc = call("gpg --no-tty --no --verify %s.asc %s 2>/dev/null" % (envfn, envfn)) if rc == 0: log.msg("%s: OK" % envfn) else: log.error('env signature verify failed!') return rc
def main(argv=None): if argv is None: argv = sys.argv[1:] # pragma: no cover args = _getArgs(argv) log.info("sadm-web v%s" % version.get()) log.msg("http://%s:%d/" % ('localhost', args.port)) syslog.init() app.run('localhost', args.port, args.debug) syslog.close() log.msg('done!') return 0
def _importenv(envfn): srcfn = envfn[:-4] rootdir = path.dirname(path.dirname(envfn)) deploydir = path.join(rootdir, 'deploy') envdir = path.join(deploydir, path.basename(srcfn)) if path.isdir(envdir): sh.rmtree(envdir) sh.makedirs(envdir) sh.chmod(envdir, 0o0700) log.msg("%s.zip: unpack" % srcfn) sh.unpack_archive(srcfn + '.zip', extract_dir=envdir, format='zip')
def loadenv(filename): envfn = path.abspath(filename) log.msg("%s: load" % envfn) rc = _check(envfn) if rc != 0: return rc if path.isfile(envfn + '.asc'): rc = _verify(envfn) if rc != 0: return rc rc = call("sha256sum -c %s" % envfn) if rc != 0: log.error('env checksum failed!') return rc _importenv(envfn) return 0