コード例 #1
0
def do_status_show(cc, args):
    status = cc.status.get(
        platform_id=args.platform_id,
        product_version_id=args.product_version_id)
    data = dict([(f, getattr(status, f, ''))
                 for f in res_fields.STATUS_FIELDS])
    cliutils.print_dict(data, wrap=72)
コード例 #2
0
def do_status_update(cc, args):
    """Update a status."""

    old = cc.status.get(args.platform_id, args.product_version_id)
    old_dict = old.to_dict()
    new_dict = old_dict.copy()
    new_dict.update(dict([x.split("=") for x in args.attributes[0]]))

    # TODO(chmou): detect if there was an update to do,
    cc.status.update(new_dict)

    # TODO(chmou): we need to have a redirect on PUT to show the newly changed
    # resource
    status = cc.status.get(args.platform_id, args.product_version_id)
    data = dict([(f, getattr(status, f, ''))
                 for f in res_fields.STATUS_FIELDS])
    cliutils.print_dict(data, wrap=72)
コード例 #3
0
def do_status_update(cc, args):
    """Update a status."""

    old = cc.status.get(args.platform_id, args.product_version_id)
    old_dict = old.to_dict()
    new_dict = old_dict.copy()
    new_dict.update(dict([x.split("=") for x in args.attributes[0]]))

    # TODO(chmou): detect if there was an update to do,
    cc.status.update(new_dict)

    # TODO(chmou): we need to have a redirect on PUT to show the newly changed
    # resource
    status = cc.status.get(args.platform_id, args.product_version_id)
    data = dict([(f, getattr(status, f, ''))
                 for f in res_fields.STATUS_FIELDS])
    cliutils.print_dict(data, wrap=72)
コード例 #4
0
def do_product_show(cc, args):
    """Show product information."""
    product = cc.products.get(args.name, version=args.v)

    # TODO(chmou): Separate the logic between product_show_version and
    # product_show in two different function to not have this function becoming
    # a spaghetti code.
    if args.v:
        ret = product.to_dict()
        cliutils.print_dict(ret, wrap=72)
        return

    versions = "\n".join(
        ["%s:%s" % (v['version'], v['id']) for v in product.versions])

    ret = dict(product_name=args.name,
               team=product.team,
               Contact=product.contact,
               versions=versions)
    cliutils.print_dict(ret, wrap=72)
コード例 #5
0
def do_product_show(cc, args):
    """Show product information."""
    product = cc.products.get(args.name, version=args.v)

    # TODO(chmou): Separate the logic between product_show_version and
    # product_show in two different function to not have this function becoming
    # a spaghetti code.
    if args.v:
        ret = product.to_dict()
        cliutils.print_dict(ret, wrap=72)
        return

    versions = "\n".join(["%s:%s" % (v['version'], v['id'])
                         for v in product.versions])

    ret = dict(
        product_name=args.name,
        team=product.team,
        Contact=product.contact,
        versions=versions)
    cliutils.print_dict(ret, wrap=72)
コード例 #6
0
def do_status_show(cc, args):
    status = cc.status.get(platform_id=args.platform_id,
                           product_version_id=args.product_version_id)
    data = dict([(f, getattr(status, f, ''))
                 for f in res_fields.STATUS_FIELDS])
    cliutils.print_dict(data, wrap=72)