python-tripleoclient knows the correct working directory
after baremetal deployment. Thus, it can correctly override
the tripleo_ceph_client_vars variable in tripleo-ansible roles.
Use /home/USER/overcloud-deploy/STACK/ceph_client.yml, where
everything up to ceph_client.yml comes from the utils.py
function get_default_working_dir(STACK).
When tripleo-ansible roles are called directly by the client
use --extra-vars to pass tripleo_ceph_client_vars. As per the
deployed_ceph.yaml.j2 template in tripleo-ansible, the Heat
parameter CephClientConfigVars will then be set to the same
value. Then when the tripleo-ansible roles are called by
config-download they will have the same value for
tripleo_ceph_client_vars. Update export.py to use same path.
Change-Id: I7717f2ce9f668e9fd77c9b49e2433d729ed3c836
Depends-On: I0346bf1c6a3d8796a0aa70cbaac6e34b2f74fabb
Closes-Bug: #1981467
The patch to fix the related bug (not this patch) fixes an
inconsistency where the ceph client data is somtimes exported
to the wrong path. If anyone deployed before they got the fix
to the related bug, then this patch will workaround that
problem if they export later.
When 'openstack overcloud export ceph' is run look in the
correct default location for the ceph client data and if it
is not found, then fall back to incorrect location.
Change-Id: I0b8c747481e561645eefea50cb77ca806a7f0de2
Related-Bug: #1978846
Update the overcloud export command to work without a dependency on Heat
API. The export data is updated to create the export data based solely
on saved stack output data and the config-download generated
overcloud.json so that Heat is not needed to generate the export at all.
Change-Id: I0bd4b4a0e33184e0f4d731899138bf4063f3cdac
Signed-off-by: James Slagle <jslagle@redhat.com>
Without this patch 'openstack overcloud export ceph' can
only export information from a ceph-ansible deployment as
found in the config-download directory.
This patch results in the export ceph command looking in
the config-download directory for a ceph-ansible or
cephadm directory and based on what it finds it generates
the a Heat environment with the CephExternalMultiConfig
parameter populated.
Closes-Bug: #1966772
Depends-On: I9f854377fcd0dfa570d0dc30e34d40826de8656d
Change-Id: Idbb2d9270c83ac0e97e0bdb1ea6e2992671f94aa
Add the AuthCloudName parameter to the export data. If the parameter is
already set in the stack being exported, use that value, otherwise use
the name of the stack being exported.
Change-Id: Ie9b78d11c816d234853d454ab76da8750def9bba
Signed-off-by: James Slagle <jslagle@redhat.com>
The correct export of the stack parameters no longer depends
on order of the tripleclient.constants.EXPORT_DATA,
as the lack of expected json file with parameters to export
raises exception, rather than filling the requested key with
data obtained in the previous iteration.
The I/O logic was moved to the tripleoclient.utils to keep
things more consistent.
No longer necessary json import was removed.
Tests were adjusted to mock more selectively.
Closes-Bug: #1940685
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ia7fb232261eb00c53d4e9bb352e572568704000f
New test case for handling a decoding error encountered
while reading a file.
Function documentation moved to docstring from comment,
and expanded to cover necessary API and implementation facts.
Too general 'Exception', raised if there are no data to export
for the specific key, was changed to 'RuntimeError'.
Some vars were renamed in order to improve readability.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I04f8eb15e58a2bec125f5de23ec2da7e51454e1c
Because export imports utils and utils imports export
there is a cyclic import so pylint objects PEP8 R0401.
overcloud_deploy and overcloud_export need the function
export_overcloud which depends on export. The function
export_overcloud was added to utils for that import but
this created the cyclic import. To work around this,
redefine the export_overcloud function in export and
have overcloud_deploy and overcloud_export import it
from export, not utils. Then remove the utils import
of export.
Change-Id: I8bab41ee9af9729cd63ed7132928cfbc1770887a
The 'export_data' variable in the 'tripleoclient.export.export_stack'
is accessed in read-only manner and is used to determine
parameters selected for export.
It is, effectivelly, a constant, but placed within a function
body, without declaration of it's exact contents in the docstrings.
By moving the 'export_data' among constants, we expose the information
about exported parameters, with minimal change to the original code,
as the 'tripleoclient.constants' is already imported by the module.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I408560ffbecd145b476aa5205c4fd1c780491d0c
The 'tripleoclient.export.export_passwords' function was intended
export passwords selectively, if needed, based on provided rules.
This patch restores that functionality.
Furthermore, tests were adjusted to validate exports with and
without filtering.
Function level documentation was expanded with information about
inputs and outputs.
Per suggestion, the loop was adjusted to iterate over generated passwords
rather than over `tripleo_common_constants.PASSWORD_PARAMETER_NAMES`.
The existing import of tripleo_common.constants was removed, as there
were no more references to it.
Closes-Bug: #1933237
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I397caaf314dae17a48d4aeed55f1a5a8e4ae3d41
Blocks catching base Exception were replaced
with more constrained alternatives where possible.
Alternatives were chosen based on exceptions possibly
raised by calls within the `try` clause.
Logs were altered to reflect new situation.
string method format was used for new log calls.
Unit tests were adjusted accordingly.
This patch may cause uptick in unhadled exceptions,
as previously "hidden" issues become apparent.
Increase in the number of exceptions capture,
including potential hunk revert should be done with care however.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I24612700bcbd3e17685ae7a33a27f38a2055a0fb
The overcloud export environment will be automatically created when
using ephemeral heat. Since the stack is ephemeral, we need to go ahead
and do the export before stopping Heat. While we backup the heat db so
we have the stack saved if needed, it's just eaiser and eliminates a
manual step to do the export if we do it automatically.
Signed-off-by: James Slagle <jslagle@redhat.com>
Change-Id: Idc326cb7baa54a7d2d01a2be002dfffa6a59ef6a
When 'openstack overcloud export ceph' is run, do not assume
the storage_ip will be set. Instead, find the ceph_mon_network
name in the service_net_map, e.g. 'storage' or 'ctlplane', and
then use that network name to get the IP from the inventory.
Closes-Bug: #1922788
Change-Id: I962bed846b2cae7206c76f883f9294d366031245
This changes to use the stack environment instead for
passwords when using ``overcloud export`` or
``overcloud cell export``.
Change-Id: Iae58a6415cc12e2035e0d3b62327e59e038d1b2c
The client utils will now run a new playbook to ensure that the local
archive directory is created early in the deployment process. This
change will allow us to build toward a swift-less deployment. All of
the client calls, save one, has been moved to use tripleo-common which
will assist us to better manage, and migrate from swift storage to a
local archive.
> As a product of this change all of the "webhook" calls have been
removed. which was deprecated as part of the Zaqar and Mistral work.
These calls were removed because several swift calls were tied into
them, and because mistral is no longer part of the stack, and has
been gone for a few cycles, we can safely remove these calls which
do nothing.
Depends-On: Ibe9b2ffe94cdf493fc84366979d1d78b8528ea1b
Change-Id: I7531612a49527f8a21df415c648acb41ac7a0b10
Signed-off-by: Kevin Carter <kecarter@redhat.com>
Add a new command to export Ceph information from one or
more Heat stacks to be used as input of another stack.
Creates a valid YAML file with the CephExternalMultiConfig
parameter populated.
Also have export's export_password use yaml.safe_load in
place of the deprecated yaml.load.
Closes-Bug: #1895034
Change-Id: Ibdf9115e92c6b476b99d6df785b0c7e9f23991de
The overcloud export command needs to look at both the
parameter_defaults and passwords keys from plan-environment.yaml.
passwords contains only the generated password values, while
parameter_defaults contains any user set values. If a value is not set
in parameter_defaults, then passwords can be used.
Change-Id: I6b1b8bd1e7800720f6bbbe418c1f83b2f710fb48
Closes-Bug: #1891388
Signed-off-by: James Slagle <jslagle@redhat.com>
As part of mistral removal all config-downloaded playbooks
are run from tripleoclient. This changes the download location
to $HOME/config-download.
Documentation for default location will be changed along with
all doc changes for mistral removal.
Closes-Bug: #1874432
Depends-On: https://review.opendev.org/721568/
Change-Id: Ib4c9c47baabd64f008c4f61e4fa8c37a311350a3
The use of `yaml.load` is deprecated and considered unsafe.
The warning notice:
> /usr/lib/python3.6/site-packages/tripleoclient/utils.py:2349:
YAMLLoadWarning: calling yaml.load() without Loader=...
is deprecated, as the default Loader is unsafe. Please read
https://msg.pyyaml.org/load for full details.
This change removes the use of the deprecated function, which
corrects the issue.
Change-Id: I7b747fd124880f55a30f75e5efb27c22c57ac10c
Signed-off-by: Kevin Carter <kecarter@redhat.com>
Add a new command to export the data from a control plane stack for
multi-stack. The created export file can be used as input into a compute
stack for the multi-stack feature.
Also refactors the overcloud cell export command to use the same common
code.
Closes-Bug: #1850636
Change-Id: I6e145d7a54dcd306c4633ebd4d7471a19a967a86