Comment 8 for bug 1850050

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to paunch (stable/train)

Reviewed: https://review.opendev.org/701740
Committed: https://git.openstack.org/cgit/openstack/paunch/commit/?id=611b4c91ab6a5b06b5358b1f792e3b78268b9a53
Submitter: Zuul
Branch: stable/train

commit 611b4c91ab6a5b06b5358b1f792e3b78268b9a53
Author: Emilien Macchi <email address hidden>
Date: Sun Oct 27 21:26:15 2019 +0100

    Fix backward compatibility for old config startup files

    In I1cf8923a698d0f6e0b1e00a7985f363a83e914c4, we changed the format for
    container-startup-config and now have one JSON file per container, per
    step. It'll make it easier to operate containers one by one, instead of
    in one big JSON per step.

    However this change wasn't 100% backward compatible, and this patch aims
    to fix it.

    This patch does:

    1) Support a directory of configs without container name

    The --file argument can now be a directory where the container
    configuration file is located.

    Example:
    paunch debug (...) --file /var/lib/tripleo-config/container-startup-config/step_1

    All configs will be returned.

    2) Support a directory of config and a container name

    Example:
    paunch debug (...) --container haproxy --file /var/lib/tripleo-config/container-startup-config/step_1

    Only the container config will be returned.

    3) Support the old format file without container name

    If the user specifies:
    --file /var/lib/tripleo-config/hashed-container-startup-config-step_1.json

    It'll return all container configs for the JSON files in:
    /var/lib/tripleo-config/container-startup-config/step_1/ (directory)

    4) Support the old format file with container name

    If the user specifies:
    --container haproxy --file /var/lib/tripleo-config/hashed-container-startup-config-step_1.json

    It'll return the hashed container config file:
    /var/lib/tripleo-config/container-startup-config/step_1/hashed-haproxy.json

    5) Add support for running paunch with a file + new format

    The new format would be:

    --container haproxy --file /var/lib/tripleo-config/container-startup-config/step_1/hashed-haproxy.json

    The container config would be returned.

    Note: if no name is specified, it'll try to guess the name based on the
    file name. It'll remove "hashed-' from it in case it was an hashed file.

    This patch should resolve all backward compatibility issues so Paunch
    can be used with both the new and old format.

    Closes-Bug: #1850050
    Change-Id: I917679da22fa09614e73053654df6ce181cf98fe
    (cherry picked from commit 68ecaf90611718e1fb1ac77e7eb199036ff1c769)