diff mbox series

[v2,4/7] iotests.py: don't abort if IMGKEYSECRET is undefined

Message ID 20181213015013.15350-5-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show
Series bitmaps: remove x- prefix from QMP api | expand

Commit Message

John Snow Dec. 13, 2018, 1:50 a.m. UTC
Instead of using os.environ[], use .get with a default of empty string
to match the setup in check to allow us to import the iotests module
(for debugging, say) without needing a crafted environment just to
import the module.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/qemu-iotests/iotests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake Dec. 13, 2018, 2:16 a.m. UTC | #1
On 12/12/18 7:50 PM, John Snow wrote:
> Instead of using os.environ[], use .get with a default of empty string
> to match the setup in check to allow us to import the iotests module
> (for debugging, say) without needing a crafted environment just to
> import the module.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   tests/qemu-iotests/iotests.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index d537538ba0..a34e66813a 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -63,7 +63,7 @@ socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
>   debug = False
>   
>   luks_default_secret_object = 'secret,id=keysec0,data=' + \
> -                             os.environ['IMGKEYSECRET']
> +                             os.environ.get('IMGKEYSECRET', '')
>   luks_default_key_secret_opt = 'key-secret=keysec0'
>   
>   
>
Vladimir Sementsov-Ogievskiy Dec. 13, 2018, 12:42 p.m. UTC | #2
13.12.2018 4:50, John Snow wrote:
> Instead of using os.environ[], use .get with a default of empty string
> to match the setup in check to allow us to import the iotests module
> (for debugging, say) without needing a crafted environment just to
> import the module.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>


Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   tests/qemu-iotests/iotests.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index d537538ba0..a34e66813a 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -63,7 +63,7 @@ socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
>   debug = False
>   
>   luks_default_secret_object = 'secret,id=keysec0,data=' + \
> -                             os.environ['IMGKEYSECRET']
> +                             os.environ.get('IMGKEYSECRET', '')
>   luks_default_key_secret_opt = 'key-secret=keysec0'
>   
>   
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index d537538ba0..a34e66813a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -63,7 +63,7 @@  socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
 debug = False
 
 luks_default_secret_object = 'secret,id=keysec0,data=' + \
-                             os.environ['IMGKEYSECRET']
+                             os.environ.get('IMGKEYSECRET', '')
 luks_default_key_secret_opt = 'key-secret=keysec0'