def pformat_atom_detail(atom_detail, indent=0):
    """Pretty formats a atom detail."""
    detail_type = logbook.atom_detail_type(atom_detail)
    lines = ["%s%s: '%s'" % (" " * (indent), detail_type, atom_detail.name)]
    lines.extend(_format_shared(atom_detail, indent=indent + 1))
    lines.append("%s- version = %s" %
                 (" " * (indent + 1), misc.get_version_string(atom_detail)))
    lines.append("%s- results = %s" % (" " *
                                       (indent + 1), atom_detail.results))
    lines.append("%s- failure = %s" %
                 (" " * (indent + 1), bool(atom_detail.failure)))
    lines.extend(_format_meta(atom_detail.meta, indent=indent + 1))
    return "\n".join(lines)
Example #2
0
def pformat_atom_detail(atom_detail, indent=0):
    """Pretty formats a atom detail."""
    detail_type = logbook.atom_detail_type(atom_detail)
    lines = ["%s%s: '%s'" % (" " * (indent), detail_type, atom_detail.name)]
    lines.extend(_format_shared(atom_detail, indent=indent + 1))
    lines.append("%s- version = %s"
                 % (" " * (indent + 1), misc.get_version_string(atom_detail)))
    lines.append("%s- results = %s"
                 % (" " * (indent + 1), atom_detail.results))
    lines.append("%s- failure = %s" % (" " * (indent + 1),
                                       bool(atom_detail.failure)))
    lines.extend(_format_meta(atom_detail.meta, indent=indent + 1))
    return "\n".join(lines)
Example #3
0
def _atomdetails_merge(ad_m, ad):
    atom_type = logbook.atom_detail_type(ad)
    if atom_type != ad_m.atom_type:
        raise exc.StorageFailure("Can not merge differing atom types "
                                 "(%s != %s)" % (atom_type, ad_m.atom_type))
    ad_d = ad.to_dict()
    ad_m.state = ad_d['state']
    ad_m.intention = ad_d['intention']
    ad_m.results = ad_d['results']
    ad_m.version = ad_d['version']
    ad_m.failure = ad_d['failure']
    ad_m.meta = ad_d['meta']
    ad_m.name = ad_d['name']
    return ad_m
Example #4
0
def _atomdetails_merge(ad_m, ad):
    atom_type = logbook.atom_detail_type(ad)
    if atom_type != ad_m.atom_type:
        raise exc.StorageFailure("Can not merge differing atom types "
                                 "(%s != %s)" % (atom_type, ad_m.atom_type))
    ad_d = ad.to_dict()
    ad_m.state = ad_d['state']
    ad_m.intention = ad_d['intention']
    ad_m.results = ad_d['results']
    ad_m.version = ad_d['version']
    ad_m.failure = ad_d['failure']
    ad_m.meta = ad_d['meta']
    ad_m.name = ad_d['name']
    return ad_m
Example #5
0
def _convert_ad_to_internal(ad, parent_uuid):
    converted = ad.to_dict()
    converted['atom_type'] = logbook.atom_detail_type(ad)
    converted['parent_uuid'] = parent_uuid
    return models.AtomDetail(**converted)
Example #6
0
def _format_atom(atom_detail):
    return {
        'atom': atom_detail.to_dict(),
        'type': logbook.atom_detail_type(atom_detail),
    }
Example #7
0
 def _insert_atom_details(self, conn, ad, parent_uuid):
     value = ad.to_dict()
     value['parent_uuid'] = parent_uuid
     value['atom_type'] = logbook.atom_detail_type(ad)
     conn.execute(sql.insert(self._tables.atomdetails, value))
Example #8
0
def _convert_ad_to_internal(ad, parent_uuid):
    converted = ad.to_dict()
    converted['atom_type'] = logbook.atom_detail_type(ad)
    converted['parent_uuid'] = parent_uuid
    return models.AtomDetail(**converted)
Example #9
0
 def _insert_atom_details(self, conn, ad, parent_uuid):
     value = ad.to_dict()
     value['parent_uuid'] = parent_uuid
     value['atom_type'] = logbook.atom_detail_type(ad)
     conn.execute(sql.insert(self._tables.atomdetails, value))