Symlinks to environment files don't work when using --environment-directory

Bug #1638428 reported by Graeme Gillies
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Expired
Undecided
Unassigned

Bug Description

When doing an overcloud deploy command similar to

time openstack overcloud deploy \
--templates templates \
--environment-directory environments-ssl \
-t 180 \
--validation-warnings-fatal \
--overcloud-ssh-user rdo-admins

and the contents of environments-ssl is

01-puppet-pacemaker.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/puppet-pacemaker.yaml
02-network-isolation.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/network-isolation.yaml
03-ips-from-pool-all.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/ips-from-pool-all.yaml
04-storage-environment.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/storage-environment.yaml
05-enable-tls.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/enable-tls.yaml
06-tls-endpoints-public-dns.yaml -> /home/stack/nuclab-tripleo/openstack-deployment/templates/environments/tls-endpoints-public-dns.yaml
10-nuclab-host-definitions.yaml
11-nuclab-storage-environment.yaml
12-nuclab-network-environment.yaml
13-nuclab-customisations.yaml
14-nuclab-enable-ssl.yaml

It looks like none of the symlinked environment files (which are from my tht directory) are included. I think this is a bug as I don't think we want to encourage users to copy standard tht environment files into their own directories (as they will have to maintain and update them themselves).

Likely this is just due to the way that we resolve symlinks in tripleo-common. Also note this doesn't work with relative symlinks either (though probably should).

Revision history for this message
Graeme Gillies (graeme-r-gillies) wrote :

Actually it looks like when I don't use symlinks but copy all the files in as follows

ls environments-ssl

01-puppet-pacemaker.yaml
02-network-isolation.yaml
03-ips-from-pool-all.yaml
04-storage-environment.yaml
05-enable-tls.yaml
06-tls-endpoints-public-dns.yaml
10-nuclab-host-definitions.yaml
11-nuclab-storage-environment.yaml
12-nuclab-network-environment.yaml
13-nuclab-customisations.yaml
14-nuclab-enable-ssl.yaml

I hit the same problem, so perhaps --environments-directory itself is just broken?

Revision history for this message
Graeme Gillies (graeme-r-gillies) wrote :
Download full text (4.7 KiB)

Some relevant logs when running the overcloud deploy command with --debug

Environment directory: environments-ssl
Environment directory file: environments-ssl/01-puppet-pacemaker.yaml
Environment directory file: environments-ssl/02-network-isolation.yaml
Environment directory file: environments-ssl/03-ips-from-pool-all.yaml
Environment directory file: environments-ssl/04-storage-environment.yaml
Environment directory file: environments-ssl/05-enable-tls.yaml
Environment directory file: environments-ssl/06-tls-endpoints-public-dns.yaml
Environment directory file: environments-ssl/10-nuclab-host-definitions.yaml
Environment directory file: environments-ssl/11-nuclab-storage-environment.yaml
Environment directory file: environments-ssl/12-nuclab-network-environment.yaml
Environment directory file: environments-ssl/13-nuclab-customisations.yaml
Environment directory file: environments-ssl/14-nuclab-enable-ssl.yaml
Processing environment files ['/home/stack/overcloud-env.json', u'environments-ssl/01-puppet-pacemaker.yaml', u'environments-ssl/02-network-isolation.yaml', u'environments-ssl/03-ips-from-pool-all.yaml', u'environments-ssl/04-storage-environment.yaml', u'environments-ssl/05-enable-tls.yaml', u'environments-ssl/06-tls-endpoints-public-dns.yaml', u'environments-ssl/10-nuclab-host-definitions.yaml', u'environments-ssl/11-nuclab-storage-environment.yaml', u'environments-ssl/12-nuclab-network-environment.yaml', u'environments-ssl/13-nuclab-customisations.yaml', u'environments-ssl/14-nuclab-enable-ssl.yaml']
Processing environment files /home/stack/overcloud-env.json
Processing environment files environments-ssl/01-puppet-pacemaker.yaml
Error Could not fetch contents for file:///home/stack/nuclab-tripleo/openstack-deployment/puppet/services/pacemaker/rabbitmq.yaml processing environment file environments-ssl/01-puppet-pacemaker.yaml
Rewriting environments-ssl/01-puppet-pacemaker.yaml environment to /tmp/tripleoclient-NgU9zS/tripleo-heat-templates/env-haproxy-Eqxtrc.yaml
Processing environment files environments-ssl/02-network-isolation.yaml
Error Could not fetch contents for file:///home/stack/nuclab-tripleo/openstack-deployment/network/ports/internal_api.yaml processing environment file environments-ssl/02-network-isolation.yaml
Rewriting environments-ssl/02-network-isolation.yaml environment to /tmp/tripleoclient-NgU9zS/tripleo-heat-templates/env-noop-jgHLkX.yaml
Processing environment files environments-ssl/03-ips-from-pool-all.yaml
Error Could not fetch contents for file:///home/stack/nuclab-tripleo/openstack-deployment/network/ports/noop.yaml processing environment file environments-ssl/03-ips-from-pool-all.yaml
Rewriting environments-ssl/03-ips-from-pool-all.yaml environment to /tmp/tripleoclient-NgU9zS/tripleo-heat-templates/env-storage_from_pool-QT9JSS.yaml
Processing environment files environments-ssl/04-storage-environment.yaml
Error Could not fetch contents for file:///home/stack/nuclab-tripleo/openstack-deployment/puppet/services/ceph-client.yaml processing environment file environments-ssl/04-storage-environment.yaml
Rewriting environments-ssl/04-storage-environment.yaml environment to /tmp/tripleoclient-NgU9zS/tripleo-heat-temp...

Read more...

Changed in tripleo:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Carlos Camacho (ccamacho)
Revision history for this message
Carlos Camacho (ccamacho) wrote :
Download full text (8.5 KiB)

Hey,

I just have finished some test related to how to use the --environment-directory option.

### STEP 1 ### Reproducing the issue

[stack@instack ~]$ cd
[stack@instack ~]$ pwd
/home/stack

# Creating a temp folder to move an env file
[stack@instack ~]$ mkdir kk
[stack@instack ~]$ cp tripleo-heat-templates/environments/puppet-pacemaker.yaml kk/

# We will deploy puppet-pacemaker.yaml inside the templates folder
[stack@instack ~]$ openstack overcloud deploy --libvirt-type qemu --ntp-server pool.ntp.org --templates /home/stack/tripleo-heat-templates --environment-directory /home/stack/kk/ --debug

# You have the error described in the bug.

Environment directory: kk/
Environment directory file: kk/puppet-pacemaker.yaml
Processing environment files ['/home/stack/overcloud-env.json', u'kk/puppet-pacemaker.yaml']
Processing environment files /home/stack/overcloud-env.json
Processing environment files kk/puppet-pacemaker.yaml
Error Could not fetch contents for file:///home/stack/puppet/services/pacemaker/rabbitmq.yaml processing environment file kk/puppet-pacemaker.yaml

### STEP 2 ### Checking some behaviour

The thing here is that rabbitmq.yaml is referenced using a relative path in puppet-pacemaker.yaml, relative to the --templates folder.
i.e.
  OS::TripleO::Services::RabbitMQ: ../puppet/services/pacemaker/rabbitmq.yaml

A quick workaround might be to update the path to the templates in your `kk` folder.

resource_registry:
  OS::TripleO::ControllerConfig: /home/stack/tripleo-heat-templates/puppet/controller-config-pacemaker.yaml
  OS::TripleO::Tasks::ControllerPrePuppet: /home/stack/tripleo-heat-templates/extraconfig/tasks/pre_puppet_pacemaker.yaml
  OS::TripleO::Tasks::ControllerPostPuppet: /home/stack/tripleo-heat-templates/extraconfig/tasks/post_puppet_pacemaker.yaml
  OS::TripleO::Tasks::ControllerPostPuppetRestart: /home/stack/tripleo-heat-templates/extraconfig/tasks/post_puppet_pacemaker_restart.yaml
  OS::TripleO::Services::CinderVolume: /home/stack/tripleo-heat-templates/puppet/services/pacemaker/cinder-volume.yaml
  OS::TripleO::Services::RabbitMQ: /home/stack/tripleo-heat-templates/puppet/services/pacemaker/rabbitmq.yaml
  OS::TripleO::Services::HAproxy: /home/stack/tripleo-heat-templates/puppet/services/pacemaker/haproxy.yaml
  OS::TripleO::Services::Pacemaker: /home/stack/tripleo-heat-templates/puppet/services/pacemaker.yaml
  OS::TripleO::Services::Redis: /home/stack/tripleo-heat-templates/puppet/services/pacemaker/database/redis.yaml
  OS::TripleO::Services::MySQL: /home/stack/tripleo-heat-templates/puppet/services/pacemaker/database/mysql.yaml

# Try to re-deploy.
[stack@instack ~]$ openstack overcloud deploy --libvirt-type qemu --ntp-server pool.ntp.org --templates /home/stack/tripleo-heat-templates --environment-directory /home/stack/kk/ --debug

As you can see the templates were found (We just hard wired the path)

Deploying templates in the directory /tmp/tripleoclient-CZhMjc/tripleo-heat-templates
Creating Environment file
Environment directory: /home/stack/kk/
Environment directory file: /home/stack/kk/puppet-pacemaker.yaml
Processing environment files [u'/home/stack/kk/puppet-pacemaker.yaml']
Processing environment fil...

Read more...

Revision history for this message
Graeme Gillies (graeme-r-gillies) wrote :

Hi Carlos,

You are correct if I copy the files into the directory and change the relative paths, then everything works.

However, this is not an ideal workflow. I want to be able to use the --environment-directory setting to reference my own environment files, as well as the ones I want included from tripleo. I want symlinks to work so that when I update the template files via RPM, I also will get all the latest changes to the tripleo provided ones automatically. I don't want to have to keep manually copying and changing them.

Regards,

Graeme

Revision history for this message
Carlos Camacho (ccamacho) wrote :

Yeahp,

Just to clarify, if you need to reference templates from THT use the -e option and then use the --environment-directory for your custom env. files.

i.e.

openstack overcloud deploy \
--libvirt-type qemu \
--ntp-server pool.ntp.org \
--templates /home/stack/tripleo-heat-templates \
-e /home/stack/tripleo-heat-templates/environments/puppet-pacemaker.yaml \
-e /home/stack/tripleo-heat-templates/environments/network-isolation.yaml \
-e /home/stack/tripleo-heat-templates/environments/storage-environment.yaml \
-e /home/stack/tripleo-heat-templates/environments/ips-from-pool-all.yaml \
-e /home/stack/tripleo-heat-templates/environments/storage-environment.yaml \
-e /home/stack/tripleo-heat-templates/environments/enable-tls.yaml \
-e /home/stack/tripleo-heat-templates/environments/tls-endpoints-public-dns.yaml \
--environment-directory /home/stack/nuclab/ \
--debug

Then, in /home/stack/nuclab/ save:

  00-nuclab-host-definitions.yaml
  01-nuclab-storage-environment.yaml
  02-nuclab-network-environment.yaml
  03-nuclab-customisations.yaml
  04-nuclab-enable-ssl.yaml

This will keep THT structure getting relative paths correctly and you can reference your custom env files in another place.

In this case, you don't have to change or copy any file.

Does it sound as a good approach?

Cheers,
Carlos.

Changed in tripleo:
importance: High → Low
Revision history for this message
Carlos Camacho (ccamacho) wrote :

Hi!

I'll mark this as invalid (tomorrow) if the prev answer fits the proposed use case.

Revision history for this message
Graeme Gillies (graeme-r-gillies) wrote :

No, I don't want to use that workflow.

The point of having --environment-directory is so that I can reference all environment files, my own, and symlinking in the ones from templates, so no longer need to have a massively long deploy command with -e over and over.

This is a first step towards getting the tools (python-tripleoclient etc) to natively support git, where our only option is to reference all environment files in a directory, as we won't have any command line options at all.

Please do not mark this as invalid.

Revision history for this message
Carlos Camacho (ccamacho) wrote :

Hey,

Ack I'll leave this ticket opened for further discussion and a possible fix.

Revision history for this message
Matthew Booth (mbooth-9) wrote :

Chiming in here, as I hit the same issue trying to achieve the same as Graeme for the same reasons. I want to be able to create a single config directory of stuff which does my deployment: big command lines don't work for me.

Revision history for this message
Emilien Macchi (emilienm) wrote :

There are no currently open reviews on this bug, changing the status back to the previous state and unassigning. If there are active reviews related to this bug, please include links in comments.

Changed in tripleo:
assignee: Carlos Camacho (ccamacho) → nobody
Revision history for this message
Emilien Macchi (emilienm) wrote : Cleanup EOL bug report

This is an automated cleanup. This bug report has been closed because it
is older than 18 months and there is no open code change to fix this.
After this time it is unlikely that the circumstances which lead to
the observed issue can be reproduced.

If you can reproduce the bug, please:
* reopen the bug report (set to status "New")
* AND add the detailed steps to reproduce the issue (if applicable)
* AND leave a comment "CONFIRMED FOR: <RELEASE_NAME>"
  Only still supported release names are valid (FUTURE, PIKE, QUEENS, ROCKY, STEIN).
  Valid example: CONFIRMED FOR: FUTURE

Changed in tripleo:
importance: Low → Undecided
status: Confirmed → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.