def install_custom(p, automated=False, pkg_to_group=None): """Install a single custom package by name. This method fetches names from custom.yaml that delegate to a method in the custom/name.py program. fab install_custom_package:package_name """ _setup_logging(env) env.logger.info("Install custom software packages") if not automated: _parse_fabricrc() _setup_edition(env) _setup_distribution_environment() _create_local_paths() pkg_config = os.path.join(env.config_dir, "custom.yaml") packages, pkg_to_group = _yaml_to_packages(pkg_config, None) try: env.logger.debug("Import %s" % p) mod = __import__("cloudbio.custom.%s" % pkg_to_group[p], fromlist=["cloudbio", "custom"]) except ImportError: raise ImportError("Need to write a %s module in custom." % pkg_to_group[p]) replace_chars = ["-"] try: for to_replace in replace_chars: p = p.replace(to_replace, "_") fn = getattr(mod, "install_%s" % p) except AttributeError: raise ImportError("Need to write a install_%s function in custom.%s" % (p, pkg_to_group[p])) fn(env)
def _configure_fabric_environment(env, flavor=None, fabricrc_loader=None): if not fabricrc_loader: fabricrc_loader = _parse_fabricrc _setup_flavor(env, flavor) fabricrc_loader(env) _setup_edition(env) _setup_distribution_environment() # get parameters for distro, packages etc. _create_local_paths(env)
def install_biolinux(target=None, packagelist=None, flavor=None): """Main entry point for installing Biolinux on a remote server. This allows a different main package list (the main YAML file is passed in), and/or use of Flavor. So you can say: install_biolinux:packagelist=contrib/mylist/main.yaml,flavor=specialflavor Both packagelist and flavor, as well as the Edition, can also be passed in through the fabricrc file. target can also be supplied on the fab CLI. Special targets are: - packages Install distro packages - custom Install custom packages - libraries Install programming language libraries - finalize Setup freenx and clean-up environment """ _setup_logging(env) _check_fabric_version() _parse_fabricrc() _setup_edition(env) _setup_flavor(flavor) _setup_distribution_environment( ) # get parameters for distro, packages etc. _create_local_paths() env.logger.info("packagelist=%s" % packagelist) pkg_install, lib_install = _read_main_config(packagelist) # read yaml env.logger.info("Target=%s" % target) if target is None or target == "packages": if env.distribution in ["debian", "ubuntu"]: _setup_apt_sources() _setup_apt_automation() _add_apt_gpg_keys() _apt_packages(pkg_install) elif env.distibution in ["centos"]: _setup_yum_sources() _yum_packages(pkg_install) _setup_yum_bashrc() else: raise NotImplementedError("Unknown target distribution") _update_biolinux_log(env, target, flavor) if target is None or target == "custom": _custom_installs(pkg_install) if target is None or target == "libraries": _do_library_installs(lib_install) if target is None or target == "finalize": env.edition.post_install() env.flavor.post_install() _cleanup_space() if env.has_key("is_ec2_image") and env.is_ec2_image.upper() in [ "TRUE", "YES" ]: _freenx_scripts() _configure_cloudman(env) _cleanup_ec2(env)
def install_libraries(language): """High level target to install libraries for a specific language. """ _setup_logging(env) _check_fabric_version() _parse_fabricrc() _setup_edition(env) _setup_flavor(None) _setup_distribution_environment() _create_local_paths() _do_library_installs(["%s-libs" % language])
def install_biolinux(target=None, packagelist=None, flavor=None): """Main entry point for installing Biolinux on a remote server. This allows a different main package list (the main YAML file is passed in), and/or use of Flavor. So you can say: install_biolinux:packagelist=contrib/mylist/main.yaml,flavor=specialflavor Both packagelist and flavor, as well as the Edition, can also be passed in through the fabricrc file. target can also be supplied on the fab CLI. Special targets are: - packages Install distro packages - custom Install custom packages - libraries Install programming language libraries - finalize Setup freenx and clean-up environment """ _setup_logging(env) _check_fabric_version() _parse_fabricrc() _setup_edition(env) _setup_flavor(flavor) _setup_distribution_environment() # get parameters for distro, packages etc. _create_local_paths() env.logger.info("packagelist=%s" % packagelist) pkg_install, lib_install = _read_main_config(packagelist) # read yaml env.logger.info("Target=%s" % target) if target is None or target == "packages": if env.distribution in ["debian", "ubuntu"]: _setup_apt_sources() _setup_apt_automation() _add_apt_gpg_keys() _apt_packages(pkg_install) elif env.distibution in ["centos"]: _setup_yum_sources() _yum_packages(pkg_install) _setup_yum_bashrc() else: raise NotImplementedError("Unknown target distribution") _update_biolinux_log(env, target, flavor) if target is None or target == "custom": _custom_installs(pkg_install) if target is None or target == "libraries": _do_library_installs(lib_install) if target is None or target == "finalize": env.edition.post_install() env.flavor.post_install() _cleanup_space() if env.has_key("is_ec2_image") and env.is_ec2_image.upper() in ["TRUE", "YES"]: _freenx_scripts() _configure_cloudman(env) _cleanup_ec2(env)
def _configure_fabric_environment(env, flavor=None, fabricrc_loader=None, ignore_distcheck=False): if not fabricrc_loader: fabricrc_loader = _parse_fabricrc _setup_flavor(env, flavor) fabricrc_loader(env) _setup_edition(env) # get parameters for distro, packages etc. _setup_distribution_environment(ignore_distcheck=ignore_distcheck) _create_local_paths(env)
def install_custom(p, automated=False, pkg_to_group=None): """Install a single custom package by name. This method fetches names from custom.yaml that delegate to a method in the custom/name.py program. Alternatively, if a program install method is defined in approapriate package, it will be called directly (see param p). Usage: fab [-i key] [-u user] -H host install_custom:program_name :type p: string :param p: A name of a custom program to install. This has to be either a name that is listed in custom.yaml as a subordinate to a group name or a program name whose install method is defined in either cloudbio or custom packages (eg, install_cloudman). :type automated: bool :param automated: If set to True, the environment is not loaded and reading of the custom.yaml is skipped. """ _setup_logging(env) p = p.lower() # All packages are listed in custom.yaml are in lower case time_start = _print_time_stats("Custom install for '{0}'".format(p), "start") if not automated: _parse_fabricrc() _setup_edition(env) _setup_distribution_environment() _create_local_paths() pkg_config = os.path.join(env.config_dir, "custom.yaml") packages, pkg_to_group = _yaml_to_packages(pkg_config, None) try: env.logger.debug("Import %s" % p) # Allow direct calling of a program install method, even if the program # is not listed in the custom list (ie, not contained as a key value in # pkg_to_group). For an example, see 'install_cloudman' or use p=cloudman. mod_name = pkg_to_group[p] if p in pkg_to_group else p mod = __import__("cloudbio.custom.%s" % mod_name, fromlist=["cloudbio", "custom"]) except ImportError: raise ImportError("Need to write a %s module in custom." % pkg_to_group[p]) replace_chars = ["-"] try: for to_replace in replace_chars: p = p.replace(to_replace, "_") fn = getattr(mod, "install_%s" % p) except AttributeError: raise ImportError("Need to write a install_%s function in custom.%s" % (p, pkg_to_group[p])) fn(env) _print_time_stats("Custom install for '%s'" % p, "end", time_start)
def install_biolinux(target=None, packagelist=None, flavor=None, environment=None): """Main entry point for installing Biolinux on a remote server. This allows a different main package list (the main YAML file is passed in), and/or use of Flavor. So you can say: install_biolinux:packagelist=contrib/mylist/main.yaml,flavor=specialflavor Both packagelist and flavor, as well as the Edition, can also be passed in through the fabricrc file. target can also be supplied on the fab CLI. Special targets are: - packages Install distro packages - custom Install custom packages - libraries Install programming language libraries - post_install Setup CloudMan, FreeNX and other system services - cleanup Remove downloaded files and prepare images for AMI builds environment allows adding additional information on the command line - usually for defining environments, for example environment=testing, or environment=production, will set the deployment environment and tune post-installation settings. """ _setup_logging(env) time_start = _print_time_stats("Config", "start") _check_fabric_version() _parse_fabricrc() _setup_edition(env) _setup_flavor(flavor, environment) _setup_distribution_environment() # get parameters for distro, packages etc. _create_local_paths() env.logger.info("packagelist=%s" % packagelist) pkg_install, lib_install = _read_main_config(packagelist) # read yaml env.logger.info("Target=%s" % target) if target is None or target == "packages": if env.distribution in ["debian", "ubuntu"]: _setup_apt_sources() _setup_apt_automation() _add_apt_gpg_keys() _apt_packages(pkg_install) elif env.distribution in ["centos", "scientificlinux"]: _setup_yum_sources() _yum_packages(pkg_install) _setup_yum_bashrc() else: raise NotImplementedError("Unknown target distribution") if env.nixpkgs: # ./doc/nixpkgs.md _setup_nix_sources() _nix_packages(pkg_install) _update_biolinux_log(env, target, flavor) if target is None or target == "custom": _custom_installs(pkg_install) if target is None or target == "libraries": _do_library_installs(lib_install) if target is None or target == "post_install": env.edition.post_install() env.flavor.post_install() if target is None or target == "cleanup": _cleanup_space(env) if env.has_key("is_ec2_image") and env.is_ec2_image.upper() in ["TRUE", "YES"]: _cleanup_ec2(env) _print_time_stats("Config", "end", time_start)
def install_biolinux(target=None, packagelist=None, flavor=None, environment=None, pkg_config_file_path=None): """ Main entry point for installing BioLinux on a remote server. ``packagelist`` should point to a top level file (eg, ``main.yaml``) listing all the package categories that should be installed. This allows a different package list and/or use of Flavor. So you can say:: install_biolinux:packagelist=contrib/mylist/main.yaml,flavor=specialflavor ``pkg_config_file_path`` can be used to specify a path where a custom ``packages.yaml`` and ``packages-[dist].yaml`` are located, allowing fine- grained (i.e., individual package) customization. Otherwise, default to ``./contrib`` where the CBL files are defined. Both ``packagelist`` and ``flavor``, as well as the Edition, can also be passed in through the ``fabricrc`` file. target can also be supplied on the fab CLI. Special targets are: - packages Install distro packages - custom Install custom packages - libraries Install programming language libraries - post_install Setup CloudMan, FreeNX and other system services - cleanup Remove downloaded files and prepare images for AMI builds ``environment`` allows adding additional information on the command line - usually for defining environments, for example ``environment=testing``, or ``environment=production``, will set the deployment environment and tune post-installation settings. """ _setup_logging(env) time_start = _print_time_stats("Config", "start") _check_fabric_version() _parse_fabricrc() _setup_edition(env) _setup_flavor(flavor, environment) _setup_distribution_environment() # get parameters for distro, packages etc. _create_local_paths() env.logger.debug("Meta-package list is '%s'" % packagelist) env.logger.debug("File path for explicit packages is '%s'" % pkg_config_file_path) env.logger.debug("Target is '%s'" % target) pkg_install, lib_install, custom_ignore = _read_main_config(packagelist) # read main yaml if target is None or target == "packages": if env.distribution in ["debian", "ubuntu"]: _setup_apt_sources() _setup_apt_automation() _add_apt_gpg_keys() _apt_packages(pkg_install, pkg_config_file_path=pkg_config_file_path) elif env.distribution in ["centos", "scientificlinux"]: _setup_yum_sources() _yum_packages(pkg_install) _setup_yum_bashrc() else: raise NotImplementedError("Unknown target distribution") if env.nixpkgs: # ./doc/nixpkgs.md _setup_nix_sources() _nix_packages(pkg_install) _update_biolinux_log(env, target, flavor) if target is None or target == "custom": _custom_installs(pkg_install, custom_ignore) if target is None or target == "libraries": _do_library_installs(lib_install) if target is None or target == "post_install": env.edition.post_install(pkg_install=pkg_install) env.flavor.post_install() if target is None or target == "cleanup": _cleanup_space(env) if env.has_key("is_ec2_image") and env.is_ec2_image.upper() in ["TRUE", "YES"]: _cleanup_ec2(env) _print_time_stats("Config", "end", time_start)