]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
remove improper assert usage
authorKun Huang <gareth@unitedstack.com>
Thu, 11 Jul 2013 04:04:52 +0000 (12:04 +0800)
committerKun Huang <gareth@unitedstack.com>
Thu, 11 Jul 2013 04:22:15 +0000 (12:22 +0800)
commit718a5293bc9ac36f5cbccb35296322fd7446f36d
tree053e259aa017af64f90336e099753bf2f946b339
parentcfe8dc42254e6f808bec61f89ea4a43504704000
remove improper assert usage

There're many talks about it. An assert should be used for `never
happen` cases, not common paramaters validating.

With grep, we could many all assert statement used in none-test codes:

cinder/volume/drivers/san/solaris.py:110:
cinder/volume/drivers/san/solaris.py:116:
cinder/volume/drivers/san/solaris.py:161:
cinder/volume/drivers/san/solaris.py:162:
cinder/volume/drivers/san/solaris.py:163:
cinder/volume/drivers/san/solaris.py:164:
cinder/volume/drivers/san/solaris.py:170:
    checking cmd output which should never changed, so leave it
cinder/db/sqlalchemy/migration.py:113:
    ensure file existence from impossible cases, so leave it
cinder/utils.py:
    used for functional flow, so use ValueError instead

fixes bug #1199354
Change-Id: I2b1701269bdf7c8737548e57bd940921a6256372
cinder/utils.py