Change in vdsm[master]: BZ#736114 bootstrap: override iptables if requested

Yotam Oron yoron at redhat.com
Sun Sep 25 04:00:38 UTC 2011


Yotam Oron has posted comments on this change.

Change subject: BZ#736114 bootstrap: override iptables if requested
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(5 inline comments)

....................................................
File vds_bootstrap/vds_bootstrap.py
Line 159: -A INPUT -p tcp --dport 22 -j ACCEPT
Line 160: # guest consoles
Line 161: -A INPUT -p tcp -m multiport --dports 5634:6166 -j ACCEPT
Line 162: # migration
Line 163: -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT
Please define constants and use them here (no bare numbers in the strings)
Line 164: # snmp
Line 165: -A INPUT -p udp --dport 161 -j ACCEPT
Line 166: #
Line 167: -A INPUT -j REJECT --reject-with icmp-host-prohibited


Line 724:     def overrideFirewall(self):
Line 725:         self.message = 'overriden firewall successfully'
Line 726:         self.rc = True
Line 727:         self.st = 'OK'
Line 728:         f = file('/etc/sysconfig/iptables', 'w')
Please use a constant for this file name
Line 729:         try:
Line 730:             f.write(__DEFAULT_IPTABLES__)
Line 731:         finally:
Line 732:             f.close()


Line 726:         self.rc = True
Line 727:         self.st = 'OK'
Line 728:         f = file('/etc/sysconfig/iptables', 'w')
Line 729:         try:
Line 730:             f.write(__DEFAULT_IPTABLES__)
Can this fail for some reason ?
What happens if only partial file is written ?
Line 731:         finally:
Line 732:             f.close()
Line 733: 
Line 734:         self._xmlOutput('Firewall', self.st, None, None, self.message)


Line 871: def main():
Line 872:     """
Line 873:         Usage: vds_compat.py [-r rev_num] [-O organizationName] [-t systemTime]
Line 874:             [-n netconsole_host:port] [-u (seProductRepo) true|false ]
Line 875:             [-f (firewall) ] <url> <subject> <random_num>
I never saw round brackets in usage message before (Yes, I know someone else used it before in this message, but this is confusing, the user might think she actually needs to add something after the '-f')
Line 876:     """
Line 877:     try:
Line 878:         rev_num = None
Line 879:         orgName = 'Red Hat Inc.'


Line 894:             if o == "-u":
Line 895:                 usevdcrepo = (v.upper() == 'TRUE')
Line 896:             elif o == '-f':
Line 897:                 overrideFirewall = True
Line 898:                 NEEDED_SERVICES.append('iptables')
You actually have 2 actions here: starting the firewall and setting the default configuration for it. Better reflect it in the configuration flags (maybe -f just for starting the firewall and -F for also setting the defaults)
Line 899: 
Line 900:         url = args[0]
Line 901:         subject = args[1]
Line 902:         random_num = args[2]


--
To view, visit http://gerrit.usersys.redhat.com/945
To unsubscribe, visit http://gerrit.usersys.redhat.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a2e7d0512a2c9fc691135bf42b03fdcb3ee088a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Yotam Oron <yoron at redhat.com>


More information about the vdsm-patches mailing list