Simone Tiraboschi has posted comments on this change.

Change subject: packaging: setup: fixing iptables review dialog
......................................................................


Patch Set 2:

(2 comments)

http://gerrit.ovirt.org/#/c/34011/2/packaging/setup/plugins/ovirt-engine-common/base/network/firewall_manager_iptables.py
File 
packaging/setup/plugins/ovirt-engine-common/base/network/firewall_manager_iptables.py:

Line 136:                 with open(
Line 137:                         osetupcons.FileLocations.SYSCONFIG_IPTABLES,
Line 138:                         'r'
Line 139:                 ) as current:
Line 140:                     current_rules = current.read().splitlines()
> This pattern is racy. Instead you can simply open the file, and handle ENOE
Ok on errno.ENOENT: it's more clear.
readlines() and read().splitlines() aren't really the same cause the former 
keeps '\n' at the end of the read line while the latter will remove it; in 
general we prefer to store string without the newline char.
Line 141:             if 
os.path.isfile(osetupcons.FileLocations.OVIRT_IPTABLES_EXAMPLE):
Line 142:                 with open(
Line 143:                         
osetupcons.FileLocations.OVIRT_IPTABLES_EXAMPLE,
Line 144:                         'r'


Line 186:                         ),
Line 187:                         prompt=True,
Line 188:                         true=_('Yes'),
Line 189:                         false=_('No'),
Line 190:                         default=False,
> This block should go into some method like create_dialog()
This dictionary is user for the environment, each value should be initialized 
to a default value (also None is a good one) on a former stage.
Line 191:                     )
Line 192:                 else:
Line 193:                     interactive = False
Line 194: 


-- 
To view, visit http://gerrit.ovirt.org/34011
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f16a90a074052226882d76fc80918ed276d379c
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
Gerrit-Reviewer: Lev Veyde <lve...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Simone Tiraboschi <stira...@redhat.com>
Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to