Re: [rhel6-branch] Copy /etc/multipath/wwids to the sysimage.

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

 



> @@ -902,6 +903,25 @@ def setup_translations(module):
>          add_po_path(module, TRANSLATIONS_UPDATE_DIR)
>      module.textdomain("anaconda")
>  
> +def copy_to_sysimage(source, root_path=None, anaconda=None):
> +    if not root_path and not anaconda:
> +        raise AttributeError("copy_to_sysimage: "
> +                             "'root_path' or 'anaconda' need to be specified.")
> +    if not os.access(source, os.R_OK):
> +        log.info("copy_to_sysimage: source '%s' does not exist." % source)
> +        return False
> +
> +    root = root_path
> +    if not root:
> +        root = anaconda.rootPath
> +    target = root_path + source
> +    target_dir = os.path.dirname(target)
> +    log.debug("copy_to_sysimage: '%s' -> '%s'." % (source, target))
> +    if not os.path.isdir(target_dir):
> +        os.makedirs(target_dir)
> +    shutil.copy(source, target)
> +    return True
> +
>  def get_sysfs_attr(path, attr):
>      if not attr:
>          log.debug("get_sysfs_attr() called with attr=None")

Wouldn't it make more sense if copy_to_sysimage just took a rootPath
parameter, defaulted to "/mnt/sysimage", always?  Then callers could
decide whether to pass anything or to pass anaconda.rootPath.  I'm not
so much a fan of having required arguments without values that will
result in errors, even though I'm sure I have done it many times.

- 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