def __init__(self, common_name, modhash, key, csr, crt, bug, sans=None, expiry=None, authority=None, destinations=None, timestamp=None): if authority: assert isinstance(authority, dict) self.common_name = common_name self.modhash = modhash self.key = key self.csr = csr self.crt = crt self.bug = bug self.sans = sans self.expiry = expiry self.authority = authority self.destinations = destinations if destinations else {} self.timestamp = timestamp if timestamp else Bundle.timestamp
def simple(obj): if istuple(obj): key, value = obj if isinstance(value, str) and key[-3:] in ('crt', 'csr', 'key'): value = key[-3:].upper() return key, value return obj
def __init__(self, common_name, timestamp, modhash, key, csr, crt, bug, sans=None, expiry=None, authority=None, destinations=None): if authority: assert isinstance(authority, dict) self.common_name = common_name self.timestamp = timestamp self.modhash = modhash self.key = key self.csr = csr self.crt = crt self.bug = bug self.sans = sans self.expiry = expiry self.authority = authority self.destinations = destinations if destinations else {} with open(DIRPATH + '/README.tarfile') as f: self.readme = f.read()
def abbrev(obj): if istuple(obj): key, value = obj if isinstance(value, str) and key[-3:] in ('crt', 'csr', 'key'): lines = value.split('\n') lines = lines[:2] + ['...'] + lines[-3:] value = '\n'.join(lines) return key, value return obj
def visit(obj, func=printit): obj1 = None if isdict(obj): obj1 = {} for key, value in obj.items(): if isscalar(value): key1, value1 = visit((key, value), func=func) else: key1 = key value1 = visit(value, func=func) obj1[key1] = value1 elif islist(obj): obj1 = [] for item in obj: obj1.append(visit(item, func=func)) elif isscalar(obj) or istuple(obj) and len(obj) == 2: obj1 = func(obj) elif isinstance(obj, datetime): obj1 = func(obj) else: raise VisitError(obj) return obj1