output of group vars that are not string/ints may include python encoding

Bug #1801162 reported by Alex Schultz on 2018-11-01
44
This bug affects 6 people
Affects Status Importance Assigned to Milestone
tripleo
High
Alex Schultz

Bug Description

While implementing the chrony works, the group vars for it are including the python encoding which breaks the configuration files. I tracked this down to the group vars file for the role which looked like:

chrony_role_action: all
chrony_global_pool_settings: iburst minpoll 6 maxpoll 10
chrony_global_server_settings: iburst minpoll 6 maxpoll 10
any_errors_fatal: True
chrony_ntp_servers: []
max_fail_percentage: 15
chrony_manage_package: True
chrony_ntp_pools: [u'pool.ntp.org']
chrony_acl_rules: [u'deny all']

The ntp pools/and acl rules are arrays of strings from heat. When we output it to a file, it maintains the encoding and ansible will write it out as a string (Example, u'pool.ntp.org')

Teh config file ends up like...
[zuul@subnode-0 ~]$ cat /etc/chrony.conf
# Do not manually edit this file.
# Managed by ansible-role-chrony
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
pool u'pool.ntp.org' iburst minpoll 6 maxpoll 10
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
u'deny all'
driftfile /var/lib/chrony/drift
logdir /var/log/chrony
rtcsync
makestep 1.0 3

This appears to be because we are outputting the vars using a jinja template rather than properly outputting yaml.

Fix proposed to branch: master
Review: https://review.openstack.org/614876

Changed in tripleo:
status: Triaged → In Progress

Reviewed: https://review.openstack.org/614876
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=279543d7c9d1647b0c5d9281da70d279da13ea66
Submitter: Zuul
Branch: master

commit 279543d7c9d1647b0c5d9281da70d279da13ea66
Author: Alex Schultz <email address hidden>
Date: Thu Nov 1 15:42:11 2018 -0600

    Use pyyaml to output group vars

    Because the ansible group vars can be more complex structures than
    strings and ints, we should use yaml to output the groupvars files. This
    will allow list or dict values to be correctly represented in the
    ansible vars files.

    Change-Id: I79b3e6a5e7acb5f95d65034a2908a005d9a343db
    Closes-Bug: #1801162

Changed in tripleo:
status: In Progress → Fix Released
DanCreed (dan-creed) wrote :

I was trying to track it down? Is there a temporary workaround, or do I have to wait for the fix? What is the typical ETA on this kind of fix for tripleo these days, I haven't reported a bug in a while..

DanCreed (dan-creed) wrote :

FYI: I literally built the undercloud etc yesterday from the latest delorean repos... so not sure how anything on the containers could be out of date?

This issue was fixed in the openstack/tripleo-common 10.2.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers