This reverts commit 33241a84c1
The requirements check fails since
Ia4e086162e65a51af417a8b381ae898c95966a09 removed paunch as valid
dependency.
Since Paunch is retired, this patch propose to switch to use docker cli
for docker cmd hook and remove any dependency to Paunch.
Change-Id: I9c3839e551259fb85b191a27fa054c605964f30e
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Remove hacking and friends from lower-constraints, they are not needed
for installation.
Change-Id: I035eb2f83c289ff994c77b02d5f3c2f9a0d583d8
This test breaks frequently as it is asserting the docker calls which
paunch is making internally. These calls are changing often, as paunch
is in active development.
This change rewrites the test to be a unit test of hook-docker-cmd.py
specifically, with calls to paunch.apply mocked out.
Change-Id: Ieeef3e5916e46d006a358f132bbd64f3960e1fcd
Task: 36342
paunch was changed to support podman, it breaks some arguments, and
expectations in our tests. Let's fix that.
Change-Id: I7127cc2edb9af785e0533e0a1e5f2608417390e7
This organizes the heat-agents docs as per the openstackdocs format.
Also adds the team and repository tags.
Change-Id: I997dd3f52c9cd9f8ea274520e033de3ef582401c
paunch is a library and utility which is now in OpenStack
under the TripleO umbrella. It contains the logic currently in the
docker-cmd hook exposed as a python library and command utility.
This change switches the docker-cmd hook to paunch.
Asserting --label arguments has been split out from the other docker
run arguments so that paunch can add new --label arguments in future
releases without breaking these tests.
paunch-1.1.0 has just been release which contains new idempotency
behaviour, so the tests have been modified to work with the new docker
command behaviour that idempotency requires.
Change-Id: I884c38ade06ab0e01432837c43f29b123e65fa3c
It seems that during the undercloud upgrade heat-config can be empty,
and if it is, the heat-config-docker-cmd hook returns 1 and makes
os-refresh-config fail, consequently failing the undercloud upgrade.
Change-Id: Ia62e40e05f46e7e4450c6b230ddeec9b861e99bd
Related-Bug: #1648249
Closes-Bug: #1692899
Add docker hook for environment files.
Some containerized services need to accept environment
files and cannot be configured otherwise, for example
Etcd key-value storage.
Partial-bug: #1668938
Change-Id: I228b5f9ee67215ae742760d449b9cd8a4b9543d0
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This change supports specifying commands as strings by spliting the
string into a list using python's default whitespace string split().
This will handle simple string commands but not cases like
quoted/escaped spaces. Other cases can be handled by specifying the
command as a list instead.
Change-Id: Icc4eebe324a4e6a7dd06f697ef16d38777f90861
This change refactors the arg building so that the logic is contained
in dedicated functions for 'docker run' and 'docker exec', instead of
being split between the main loop and docker_arg_map.
Minor changes in behaviour which don't affect the tests include:
- No longer force ascii encoding of arg values
- Extra check to ensure the command is a list before extending cmd
- Remove the unicode/empty-string list value check
Change-Id: I09f3d2ee98020de556a3d0aa72721fe8b7420b2a
Once 50-heat-config-docker-cmd (or any other container managing tool)
deletes existing containers, 50-heat-config-docker-cmd can check if
any containers do not have their desired name, and rename them where
possible.
Change-Id: I1bc9fa4880b2487b15e28da67c4fad79312d54ad
When a container already exists with the desired name, the container
name has a random suffix attached to it so that it can still be run.
This ensures containers are always created regardless of other running
containers.
Since the name may not be as expected, the exec action needs an extra
lookup to attempt to discover the actual name, falling back to the
requested name if the lookup fails.
Since there is a container_name label set with the desired
name, the next patch in this series modifies 50-heat-config-docker-cmd
to rename containers to their desired name when possible.
Change-Id: Ibd97f52811f653295559d000487d2c50a7c67ece
This rewrites 50-heat-docker-cmd to not require any state directory to
make decisions on what containers to delete. Instead the labels on the
running containers are used to make decisions on when containers
should be deleted.
This also changes the behaviour to ignore the config name and strictly
use the config id, so all containers for a given config id are deleted
when that config no longer appears in the list of configs. This maps
correctly to heat's software deployment model and allows a future
change to properly implement replace_on_change[1] behaviour.
Containers created with an older docker-cmd (or create any other way)
will never be deleted by 50-heat-config-docker-cmd. This will result
in docker run failures when unique container names are re-used and
will require manual intervention to delete the old containers before
continuing.
[1] http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::SoftwareConfig-prop-inputs-*-replace_on_change
Change-Id: Iaf56c2b5fcb4969ce09480742f13a04d35bd2bae
Docker labels are metadata associated with running containers. This
change sets labels which will allow the correct lifecycle decisions
to be made by the docker-cmd hook about which containers are managed
by heat and when specific containers should be deleted.
Associating these labels now will also allow the os-refresh-config
50-heat-config-docker-cmd to be rewritten to not require a directory
to store state, and instead get all of the current state information
from 'docker ps' and 'docker inspect' calls.
Change-Id: I967df26c8b0661413dc504c45d1764d23f895530
This will be useful later when many docker calls are made to
introspect currently running containers.
Change-Id: Id2b0a74c974b2844b21061fb54b498bf88c50435
Allow for ordering containers execution within the same step. This hook
uses `start_order` and it defaults to 0.
Co-Authored-by: Ian Main <imain@redhat.com>
Change-Id: Ib0804ee622e2889e6c18a76f07a194490f4721d4
Some command we need to run with 'exec' or 'run' have custom
exit codes that are valid if the command completes sucessfully.
This patch adds an 'exit_codes' option which takes an array
of integers that are meant to represent the valid exit codes
for this hook. If for example 0 or 1 is meant to be considered
success you can specify:
exit_codes: [0,1]
Previously an non-zero exit code would always fail this hook.
Change-Id: Ia6ca4b01982a0b33b26eca2a907d9d9f87c19922
This patch simplies the check for privileged so that we treat
it as a pass through string. Previously we were converting
to a string before doing the boolean check which was causing
all containers to get set to --privileged true.
Change-Id: Ibe2221abf9616c1c54acecf7c18ae36e2c07576c
On python <3.4 the separator for json.dump() defaulted to (', ', ': ')
which may cause trailing whitespaces in rendered JSON files when used
with indent. This change sets the separator to (',', ': ') to prevent
trailing whitespaces with older versions of python.
See https://docs.python.org/2/library/json.html#basic-usage
Change-Id: I81fabd54659bdb28da43fb4900f19dd94a70336c
We've got a few cases where running an exec in an
already running container would be useful. This patch
adds a new action 'exec' support so that you can used a
named docker containers.
Co-authored-by: Ian Main <imain@redhat.com>
Change-Id: I2f8640232442f559206b2972117b74eec6d2c086