Inconsistent keyword parameter in fuel-qa update_yaml

Bug #1498567 reported by Alexandr Kostrikov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
Medium
Vasily Gorin

Bug Description

Keyword parameter in update_yaml in helpers/utils.py has following signature

is_uniq - If true, add the unique two-digit suffix to the variable name.

https://github.com/stackforge/fuel-qa/blob/stable/7.0/fuelweb_test/helpers/utils.py#L182-L214

>>> update_yaml(['test'], '{:.2f}'.format(21), is_uniq=True, yaml_file=yaml_path)
>>> update_yaml(['test'], '{:.2f}'.format(23), is_uniq=False, yaml_file=yaml_path)
>>> update_yaml(['test'], '{:.2f}'.format(23), is_uniq=False, yaml_file=yaml_path)
>>> update_yaml(['test'], '{:.2f}'.format(44), is_uniq=True, yaml_file=yaml_path)

cat test.yaml
test: '44.00'
test_00: '23.00'
test_01: '23.00'

As it is clear False is working as True and True is working as False. This is due to lines at
https://github.com/stackforge/fuel-qa/blob/stable/7.0/fuelweb_test/helpers/utils.py#L203-L206

if is_uniq:
        last = yaml_tree[-1]
    else:
        # Create an uniq suffix in range '_00' to '_99'

Bug has no effects on end-user because it is used only in one place and is adapted to work properly

Changed in fuel:
status: New → Confirmed
tags: added: non-release
Vasily Gorin (vgorin)
Changed in fuel:
assignee: Fuel QA Team (fuel-qa) → Vasily Gorin (vgorin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-qa (master)

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

Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
Dennis Dmitriev (ddmitriev) wrote :

Looks like there is a mistake in description for 'is_uniq' in docstring. is_uniq=True should mean 'overwrite the same variable', is_uniq=False should mean 'store values separately with shuffix _NN'.

<uniq> means here that there is only one value for some variable, without any duplicates.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-qa (master)

Reviewed: https://review.openstack.org/235212
Committed: https://git.openstack.org/cgit/stackforge/fuel-qa/commit/?id=ed02e1b6a65516fa85d3c34ce5738f32480dffa3
Submitter: Jenkins
Branch: master

commit ed02e1b6a65516fa85d3c34ce5738f32480dffa3
Author: vgorin <email address hidden>
Date: Thu Oct 15 13:00:55 2015 +0300

    Change decription of is_uniq value in update_yaml, which can mislead

    Change-Id: Ie245ca5fc7b9b87ea55ac0af08baec1dca1e403e
    Closes-Bug: #1498567

Changed in fuel:
status: In Progress → Fix Committed
Dmitry Pyzhov (dpyzhov)
tags: added: area-qa
Changed in fuel:
status: Fix Committed → Fix Released
tags: removed: non-release
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.