[PATCH stable-2.16 4/6] Sprinkle some more list comprehensions

2016-08-12 Thread 'Brian Foley' via ganeti-devel
To give some, hopefully, marginally more readable Python. Signed-off-by: Brian Foley --- lib/cmdlib/cluster/__init__.py | 6 -- lib/cmdlib/cluster/verify.py | 25 - 2 files changed, 16 insertions(+), 15 deletions(-) diff --git

[PATCH stable-2.16 6/6] Simplify some inscrutable map/map/ifilter/zip code

2016-08-12 Thread 'Brian Foley' via ganeti-devel
This version traverses the results twice but is probably faster because it generates fewer temporary results. Signed-off-by: Brian Foley --- lib/client/gnt_cluster.py | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/client/gnt_cluster.py

[PATCH stable-2.16 5/6] Avoid overuse of operator in watcher *.py

2016-08-12 Thread 'Brian Foley' via ganeti-devel
The replacement code is slightly longer, but much more pythonic. Signed-off-by: Brian Foley --- lib/watcher/__init__.py | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/watcher/__init__.py b/lib/watcher/__init__.py

[PATCH stable-2.16 2/6] Replace uses of map/lambda with more Pythonic code

2016-08-12 Thread 'Brian Foley' via ganeti-devel
map(lambda x: expr(x), seq) can be written more simply as [expr(x) for x in seq] Signal that we need the side effects of expr by replacing map(lambda x: UpdateState(x, ...), seq) with for x in seq: UpdateState(x, ...) Signed-off-by: Brian Foley ---

[PATCH stable-2.16 0/6] Cleanup to make python code more pythonic

2016-08-12 Thread 'Brian Foley' via ganeti-devel
In particular, avoid the use of operator, partial and map when they read more like directly translated Haskell code than idiomatic python. This patchset should have no significant functional changes. If it does, I got something wrong. Brian Foley (6): Replace map(operator.attrgetter, ...)

[PATCH stable-2.16 3/6] Replace map/partial with list comprehension.

2016-08-12 Thread 'Brian Foley' via ganeti-devel
The rather Haskellish pattern map(compat.partial(fn, arg), xs) can be replaced by the much more pythonic [fn(arg, x) for x in xs] Signed-off-by: Brian Foley --- lib/cmdlib/common.py | 11 +++ lib/cmdlib/instance_query.py | 14 ++

[PATCH stable-2.16 1/6] Replace map(operator.attrgetter, ...) uses

2016-08-12 Thread 'Brian Foley' via ganeti-devel
map(operator.attrgetter("foo"), bar) can be replaced by the equivalent, shorter, and much more pythonic [b.foo for b in bar] Signed-off-by: Brian Foley --- lib/cmdlib/cluster/verify.py | 5 ++--- qa/qa_instance_utils.py | 5 +

[PATCH stable-2.16] Improve error reporting in _VerifyClientCertificates

2016-08-12 Thread 'Brian Foley' via ganeti-devel
Let the user know that the issues can be fixed using gnt-cluster renew-crypto --new-node-certificates Signed-off-by: Brian Foley --- lib/cmdlib/cluster/verify.py | 92 ++ test/py/cmdlib/cluster_unittest.py | 38 +--- 2

Re: [PATCH stable-2.16] Fix typos in gnt-cluster man page

2016-08-12 Thread 'Iustin Pop' via ganeti-devel
On Fri, Aug 12, 2016 at 03:03:18PM +0100, Ganeti Development List wrote: > Luckily, nothing that changes the meaning anywhere. > > Signed-off-by: Brian Foley LGTM, thanks.

[PATCH stable-2.16] Fix typos in gnt-cluster man page

2016-08-12 Thread 'Brian Foley' via ganeti-devel
Luckily, nothing that changes the meaning anywhere. Signed-off-by: Brian Foley --- man/gnt-cluster.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst index 2ba3a31..5c055ee 100644 ---

Re: [PATCH stable-2.16] Hide errors for expected inotify failures in unittest

2016-08-12 Thread 'Iustin Pop' via ganeti-devel
On 12 August 2016 at 15:38, Brian Foley wrote: > On Fri, Aug 12, 2016 at 03:13:53PM +0200, Iustin Pop wrote: > >On 12 August 2016 at 15:04, 'Brian Foley' via ganeti-devel > ><[1]ganeti-devel@googlegroups.com> wrote: > > > > This makes it a little easier to

Re: [PATCH stable-2.16] Hide errors for expected inotify failures in unittest

2016-08-12 Thread 'Brian Foley' via ganeti-devel
On Fri, Aug 12, 2016 at 03:13:53PM +0200, Iustin Pop wrote: >On 12 August 2016 at 15:04, 'Brian Foley' via ganeti-devel ><[1]ganeti-devel@googlegroups.com> wrote: > > This makes it a little easier to eyeball the output of make > py-tests. > >Ooh, nice, this is a very old

Re: [PATCH stable-2.16] Hide errors for expected inotify failures in unittest

2016-08-12 Thread 'Iustin Pop' via ganeti-devel
On 12 August 2016 at 15:04, 'Brian Foley' via ganeti-devel < ganeti-devel@googlegroups.com> wrote: > This makes it a little easier to eyeball the output of make py-tests. > Ooh, nice, this is a very old bug, thanks! +logger = logging.getLogger('pyinotify') > +logger.propagate = False >

[PATCH stable-2.16] Hide errors for expected inotify failures in unittest

2016-08-12 Thread 'Brian Foley' via ganeti-devel
This makes it a little easier to eyeball the output of make py-tests. Signed-off-by: Brian Foley --- test/py/ganeti.asyncnotifier_unittest.py | 4 1 file changed, 4 insertions(+) diff --git a/test/py/ganeti.asyncnotifier_unittest.py

Re: [PATCH stable-2.16] Add gnt-instance rename --force option

2016-08-12 Thread 'Viktor Bachraty' via ganeti-devel
LGTM, thanks! On Friday, August 12, 2016 at 1:09:24 PM UTC+1, Brian Foley wrote: > > This suppresses the interactive 'are you sure' check to allows instance > renaming without DNS checks to be scripted. > > Signed-off-by: Brian Foley > --- > lib/client/gnt_instance.py |

[PATCH stable-2.16] Add gnt-instance rename --force option

2016-08-12 Thread 'Brian Foley' via ganeti-devel
This suppresses the interactive 'are you sure' check to allows instance renaming without DNS checks to be scripted. Signed-off-by: Brian Foley --- lib/client/gnt_instance.py | 11 ++- man/gnt-instance.rst | 6 +- 2 files changed, 11 insertions(+), 6