Re: [master 3/3] iscsi, logging: reuse the global ISCSID in has_iscsi().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  def has_iscsi():
>      global ISCSID
> -    location = iutil.find_program_in_path("iscsid")
> -    if location:
> -        ISCSID = location
> -
> -    if ISCSID == "" or not has_libiscsi:
> -        return False
> -
> -    log.info("ISCSID is %s" % (ISCSID,))
> -
> -    # make sure the module is loaded
> -    if not os.access("/sys/module/iscsi_tcp", os.X_OK):
> -        return False
> -    return True
> +    
> +    if os.access("/sys/module/iscsi_tcp", os.X_OK):
> +        if len(ISCSID):
> +            return True
> +        else:
> +            location = iutil.find_program_in_path("iscsid")
> +            if location:
> +                ISCSID = location
> +                log.info("ISCSID is %s" % (ISCSID,))
> +                return True
> +
> +    return False
>  
>  def randomIname():
>      """Generate a random initiator name the same way as iscsi-iname"""

If you change the first test to "if not os.access..." and have it return
False, we can get rid of some of the indentation.  Also I don't think
you need to use "len(ISCSID)" there.  You can just say "if ISCSID:".

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux