Commit Graph

26 Commits

Author SHA1 Message Date
Martin Basti
d937588146 Pylint: remove unused variables from installers and scripts
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-10-06 10:43:36 +02:00
Martin Basti
45e3aee352 Pylint: enable check for unused-variables
Unused variables may:
* make code less readable
* create dead code
* potentialy hide issues/errors

Enabled check should prevent to leave unused variable in code

Check is locally disabled for modules that fix is not clear or easy or have too many occurences of
unused variables

Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-09-27 13:35:58 +02:00
Martin Basti
0f88f8fe88 Remove unused variables in the code
This commit removes unused variables or rename variables as "expected to
be unused" by using "_" prefix.

This covers only cases where fix was easy or only one unused variable
was in a module

Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-09-27 13:35:58 +02:00
Martin Babinsky
f7764cda68 Make Continuous installer continuous only during execution phase
`common.Continuous` class is a basis for uninstallers, which should execute
all the steps regardless of occuring errors. However, we would like the
installer to raise exceptions and return non-zero exit code during validation
phase when some preconditions are not met.

Add a separate exception handler which catches exceptions and logs them as
errors during execution phase only.

https://fedorahosted.org/freeipa/ticket/5725

Reviewed-By: Petr Spacek <pspacek@redhat.com>
2016-09-26 18:38:37 +02:00
Martin Babinsky
347f5ca0e1 use separate exception handlers for executors and validators
installer framework has been modified to allow for different error handling
during validation and execution phases.

https://fedorahosted.org/freeipa/ticket/5725

Reviewed-By: Petr Spacek <pspacek@redhat.com>
2016-09-26 18:38:37 +02:00
Jan Barta
71b3352ad0 pylint: fix bad-mcs-method-argument
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2016-09-22 16:52:57 +02:00
Jan Barta
8420d04f38 pylint: fix bad-mcs-classmethod-argument
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2016-09-22 16:52:57 +02:00
David Kupka
9f48c39649 installer: index() raises ValueError
Expecting IndexError instead of ValueError led to traceback instead of correctly
reporting the error situation.

https://fedorahosted.org/freeipa/ticket/5945

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2016-06-13 18:04:40 +02:00
Martin Basti
697072cac9 Py3: do not use dict.iteritems()
Py3 does not support iter* methods, this commit replaces 2 occurencies
of iteritems() to items(). The dictionaries there are not big, this is
sufficient we do not need to use six.

https://fedorahosted.org/freeipa/ticket/5623

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2016-02-23 17:14:33 +01:00
David Kupka
30fbc7e948 installer: Propagate option values from components instead of copying them.
https://fedorahosted.org/freeipa/ticket/5556

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-12-21 18:37:32 +01:00
David Kupka
2c5a662fd8 install: Run all validators at once.
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-12-08 08:12:22 +01:00
Martin Babinsky
b6a2a1cfd2 fix error reporting when installer option is supplied with invalid choice
https://fedorahosted.org/freeipa/ticket/5433

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-11-11 10:43:52 +01:00
Jan Cholasta
6a55174bb6 install: fix command line option validation
The code which calls the validators was accidentally removed, re-add it.

https://fedorahosted.org/freeipa/ticket/5386
https://fedorahosted.org/freeipa/ticket/5391
https://fedorahosted.org/freeipa/ticket/5392

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2015-11-05 10:33:01 +01:00
Simo Sorce
d03619fff3 Implement replica promotion functionality
This patch implements a new flag --promote for the ipa-replica-install command
that allows an administrative user to 'promote' an already joined client to
become a full ipa server.

The only credentials used are that of an administrator. This code relies on
ipa-custodia being available on the peer master as well as a number of other
patches to allow a computer account to request certificates for its services.

Therefore this feature is marked to work only with domain level 1 and above
servers.

Ticket: https://fedorahosted.org/freeipa/ticket/2888

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-10-15 14:24:33 +02:00
Petr Viktorin
f67155486b Alias long to int under Python 3
In py3, the two types are unified under the name "int".

Reviewed-By: Tomas Babej <tbabej@redhat.com>
2015-10-13 14:16:32 +02:00
Jan Cholasta
86edd6abeb install: Move unattended option to the general help section
https://fedorahosted.org/freeipa/ticket/4517

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2015-09-22 12:09:22 +02:00
Jan Cholasta
39f6f637a7 install: Support overriding knobs in subclasses
https://fedorahosted.org/freeipa/ticket/4517

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
2015-09-22 12:09:22 +02:00
Jan Cholasta
ebdfa4380b Use six.with_metaclass to specify metaclasses
Metaclass specification is incompatible between Python 2 and 3. Use the
six.with_metaclass helper to specify metaclasses.

Reviewed-By: Petr Viktorin <pviktori@redhat.com>
2015-09-07 08:00:11 +02:00
Petr Viktorin
9e917cae39 Use six.reraise
The three-argument raise is going away in Python 3. Use the six.reraise
helper instead.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-09-01 11:42:01 +02:00
Petr Viktorin
fb7943dab4 Use next() function on iterators
In Python 3, next() for iterators is a function rather than method.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-09-01 11:42:01 +02:00
Petr Viktorin
3bf91eab25 Use Python3-compatible dict method names
Python 2 has keys()/values()/items(), which return lists,
iterkeys()/itervalues()/iteritems(), which return iterators,
and viewkeys()/viewvalues()/viewitems() which return views.

Python 3 has only keys()/values()/items(), which return views.
To get iterators, one can use iter() or a for loop/comprehension;
for lists there's the list() constructor.

When iterating through the entire dict, without modifying the dict,
 the difference between Python 2's items() and iteritems() is
negligible, especially on small dicts (the main overhead is
extra memory, not CPU time). In the interest of simpler code,
this patch changes many instances of iteritems() to items(),
iterkeys() to keys() etc.

In other cases, helpers like six.itervalues are used.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-09-01 11:42:01 +02:00
Jan Cholasta
bae80b00a6 install: Fix logging setup in server and replica install
https://fedorahosted.org/freeipa/ticket/4468

Reviewed-By: Martin Basti <mbasti@redhat.com>
2015-06-12 05:46:31 +00:00
Jan Cholasta
6f1ae05d8d install: Allow setting usage in CLI tools
https://fedorahosted.org/freeipa/ticket/4468

Reviewed-By: David Kupka <dkupka@redhat.com>
2015-06-10 07:29:58 +00:00
Jan Cholasta
eb0251c56b install: Add support for positional arguments in CLI tools
https://fedorahosted.org/freeipa/ticket/4468

Reviewed-By: David Kupka <dkupka@redhat.com>
2015-06-10 07:29:58 +00:00
Jan Cholasta
1bf383e0cf install: Handle Knob cli_name and cli_aliases values consistently
https://fedorahosted.org/freeipa/ticket/4468

Reviewed-By: David Kupka <dkupka@redhat.com>
2015-06-10 07:29:58 +00:00
Jan Cholasta
9e9c01fba2 install: Introduce installer framework ipapython.install
https://fedorahosted.org/freeipa/ticket/4468

Reviewed-By: Martin Basti <mbasti@redhat.com>
2015-06-08 15:34:11 +00:00