[system-tests] Mutable default arguments

Bug #1512671 reported by Aleksei Stepanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
Medium
Aleksei Stepanov

Bug Description

Master branch: fuelweb_test & system_test
Default argument is mutable -> 8 times counted. It's as minimum bad practice and security issue for production (not test) use (possible to modify values from external side during execution).
Fix way:
1. set default value to None or use specific custom type for it
2. process default value in if tree at start of function

Permanent monitor:
At PyLint: warning W0102 should be monitored strictly

Tags: area-qa python
Changed in fuel:
assignee: nobody → Alexey Stepanov (astepanov-m)
importance: Undecided → Medium
status: New → In Progress
milestone: none → 8.0
summary: - Tests: Python: mutable default arguments
+ [system-tests] Mutable default arguments
Dmitry Pyzhov (dpyzhov)
tags: added: area-qa
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-qa (master)

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

commit b63dd9848bd5e6ade8c0bc740f10614be9237b45
Author: Alexey Stepanov <email address hidden>
Date: Tue Nov 3 17:58:58 2015 +0300

    Refactor & fix incorrect default args

    Fix:
      1. Default arguments should not be mutable
      2. Set could be created without set() call (little faster)
      3. Redundant parenthesis (readability)
      4. lambdas is strictly not recommended by PEP8, especially as class variables
      5. fix old style classes (not inherited from object)
    Update-reason: rebase

    Closes-Bug: #1512671

    Change-Id: Id8314b76848278b67da898600240b59cf76a7328

Changed in fuel:
status: In Progress → Fix Committed
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/245014

Changed in fuel:
status: Fix Committed → Fix Released
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.