[blivet PATCH rhel7-branch] iscsi: fix root argument being overriden by local variable (#1144463)

David Lehman dlehman at redhat.com
Fri Sep 19 14:48:41 UTC 2014


On 09/19/2014 08:06 AM, Radek Vykydal wrote:
> Resolves: rhbz#1144463
>
> introduced by commit 5b39c90ae582a8fb008c3633954a33b583
> ---
>   blivet/iscsi.py | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/blivet/iscsi.py b/blivet/iscsi.py
> index bef15bf..f3d423a 100644
> --- a/blivet/iscsi.py
> +++ b/blivet/iscsi.py
> @@ -357,7 +357,7 @@ class iscsi(object):
>
>           self.stabilize()
>
> -    def write(self, root, storage):
> +    def write(self, root_path, storage):
>           if not self.initiatorSet:
>               return
>
> @@ -374,17 +374,17 @@ class iscsi(object):
>               if autostart:
>                   node.setParameter("node.startup", "automatic")
>
> -        if not os.path.isdir(root + "/etc/iscsi"):
> -            os.makedirs(root + "/etc/iscsi", 0o755)
> -        fd = os.open(root + INITIATOR_FILE, os.O_RDWR | os.O_CREAT)
> +        if not os.path.isdir(root_path + "/etc/iscsi"):
> +            os.makedirs(root_path + "/etc/iscsi", 0o755)
> +        fd = os.open(root_path + INITIATOR_FILE, os.O_RDWR | os.O_CREAT)
>           os.write(fd, "InitiatorName=%s\n" %(self.initiator))
>           os.close(fd)
>
>           # copy "db" files.  *sigh*
> -        if os.path.isdir(root + "/var/lib/iscsi"):
> -            shutil.rmtree(root + "/var/lib/iscsi")
> +        if os.path.isdir(root_path + "/var/lib/iscsi"):
> +            shutil.rmtree(root_path + "/var/lib/iscsi")
>           if os.path.isdir("/var/lib/iscsi"):
> -            shutil.copytree("/var/lib/iscsi", root + "/var/lib/iscsi",
> +            shutil.copytree("/var/lib/iscsi", root_path + "/var/lib/iscsi",
>                               symlinks=True)
>
>       def getNode(self, name, address, port, iface):
>

You could probably change root to rootdev or similar with fewer changes 
and without changing the method signature.

David


More information about the anaconda-patches mailing list