Commit Graph

7 Commits

Author SHA1 Message Date
Kyr Shatskyy
bfd5d8b097 qa/tasks/dnsmasq: use remote.write_file
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
2020-09-04 00:02:15 +02:00
Kefu Chai
d7258ea7fd qa/tasks: use next(iter(..)) for accessing first element in a view
in python2, dict.values() and dict.keys() return lists. but in python3,
they return views, which cannot be indexed directly using an integer index.

there are three use cases when we access these views in python3:

1. get the first element
2. get all the elements and then *might* want to access them by index
3. get the first element assuming there is only a single element in
   the view
4. iterate thru the view

in the 1st case, we cannot assume the number of elements, so to be
python3 compatible, we should use `next(iter(a_dict))` instead.

in the 2nd case, in this change, the view is materialized using
`list(a_dict)`.

in the 3rd case, we can just continue using the short hand of
```py
(first_element,) = a_dict.keys()
```
to unpack the view. this works in both python2 and python3.

in the 4th case, the existing code works in both python2 and python3, as
both list and view can be iterated using `iter`, and `len` works as
well.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-04-07 20:33:47 +08:00
Kefu Chai
947a74349d qa: import with full path
to be py3 compatible

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-03-24 18:27:55 +08:00
Kyr Shatskyy
50b1823fac qa: get rid of iteritems for python3 compatibility
Fixes: https://tracker.ceph.com/issues/42267
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
2019-10-15 11:27:39 +02:00
Vasu Kulkarni
dae01bfcad qa/tests: unset immutable attribute for resolv.conf for centos ovh nodes
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
2018-03-30 11:11:41 -07:00
Casey Bodley
11570fab73 qa: clean up dnsmasq task and fix EPERM error
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2018-03-01 15:55:57 -05:00
Casey Bodley
062923515c qa: add task for dnsmasq configuration
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2017-05-12 16:53:14 -04:00