Пример #1
0
def upgrade_biosdevname_all(reboot='yes'):
    """creates repo and upgrades biosdevname in Ubuntu"""
    execute('pre_check')
    execute('create_install_repo')
    nodes = []
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '14.04':
            (package, os_type) = ('biosdevname', 'ubuntu')
    nodes = get_nodes_to_upgrade_pkg(package,
                                     os_type,
                                     *env.roledefs['all'],
                                     version='0.4.1-0ubuntu6.1')
    if not nodes:
        print "biosdevname is already of expected version"
        return
    execute(upgrade_biosdevname_node, *nodes)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #2
0
def upgrade_kernel_all(reboot='yes'):
    """creates repo and upgrades kernel in Ubuntu"""
    execute('pre_check')
    execute('create_install_repo')
    nodes = []
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '12.04':
            (package, os_type) = ('linux-image-3.13.0-34-generic', 'ubuntu')
        elif version == '14.04':
            (package, os_type) = ('linux-image-3.13.0-40-generic', 'ubuntu')
        else:
            raise RuntimeError("Unsupported platfrom (%s, %s, %s) for"
                               " kernel upgrade." % (dist, version, extra))
    nodes = get_nodes_to_upgrade_pkg(package, os_type, *env.roledefs['all'])
    if not nodes:
        print "kernel is already of expected version"
        return
    execute(upgrade_kernel_node, *nodes)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #3
0
def upgrade_kernel_all(*tgzs, **kwargs):
    """creates repo and upgrades kernel in Ubuntu"""
    reboot = kwargs.get('reboot', 'yes')
    execute('create_installer_repo')
    execute('create_install_repo', *tgzs)
    nodes = []
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '12.04':
            (package, os_type) = ('linux-image-3.13.0-34-generic', 'ubuntu')
            default_grub='Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-34-generic'
        elif version == '14.04':
            (package, os_type) = ('linux-image-3.13.0-40-generic', 'ubuntu')
            default_grub='Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-40-generic'
        else:
            raise RuntimeError("Unsupported platfrom (%s, %s, %s) for"
                               " kernel upgrade." % (dist, version, extra))
    nodes = get_nodes_to_upgrade_pkg(package, os_type, *env.roledefs['all'])
    if not nodes:
        print "kernel is already of expected version"
        return
    execute(upgrade_kernel_node, *nodes)
    execute('set_grub_default_node', *nodes, value=default_grub)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #4
0
def upgrade_kernel_all(reboot='yes'):
    """creates repo and upgrades kernel in Ubuntu"""
    execute('pre_check')
    execute('create_install_repo')
    nodes = []
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '12.04':
            (package, os_type) = ('linux-image-3.13.0-34-generic', 'ubuntu')
        elif version == '14.04':
            (package, os_type) = ('linux-image-3.13.0-40-generic', 'ubuntu')
        else:
            raise RuntimeError("Unsupported platfrom (%s, %s, %s) for"
                               " kernel upgrade." % (dist, version, extra))
    nodes = get_nodes_to_upgrade_pkg(package, os_type, *env.roledefs['all'])
    if not nodes:
        print "kernel is already of expected version"
        return
    execute(upgrade_kernel_node, *nodes)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #5
0
def upgrade_kernel_all(*tgzs, **kwargs):
    """creates repo and upgrades kernel in Ubuntu"""
    reboot = kwargs.get('reboot', 'yes')
    execute('create_installer_repo')
    execute('create_install_repo', *tgzs)
    nodes = []
    kernel_ver = kwargs.get('version')
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '12.04':
            (package, os_type) = ('linux-image-3.13.0-34-generic', 'ubuntu')
            default_grub = 'Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-34-generic'
        elif version == '14.04':
            if kernel_ver is None:
                kernel_ver = '3.13.0-106'
            (package, os_type) = ('linux-image-' + kernel_ver + '-generic',
                                  'ubuntu')
            default_grub = 'Advanced options for Ubuntu>Ubuntu, with Linux ' + kernel_ver + '-generic'
        elif 'centos linux' in dist.lower() and version.startswith('7'):
            (package, os_type) = ('kernel-3.10.0-327.10.1.el7.x86_64',
                                  'centoslinux')
        elif 'red hat' in dist.lower() and version.startswith('7'):
            (package, os_type) = ('kernel-3.10.0-327.10.1.el7.x86_64',
                                  'redhat')
        else:
            raise RuntimeError("Unsupported platfrom (%s, %s, %s) for"
                               " kernel upgrade." % (dist, version, extra))
    nodes = get_nodes_to_upgrade_pkg(package, os_type, *env.roledefs['all'])
    if not nodes:
        print "kernel is already of expected version"
        return
    execute(upgrade_kernel_node, *nodes, **kwargs)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #6
0
def upgrade_biosdevname_all(reboot='yes'):
    """creates repo and upgrades biosdevname in Ubuntu"""
    execute('pre_check')
    execute('create_install_repo')
    nodes = []
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '14.04':
            (package, os_type) = ('biosdevname', 'ubuntu')
    nodes = get_nodes_to_upgrade_pkg(package, os_type,
                *env.roledefs['all'], version='0.4.1-0ubuntu6.1')
    if not nodes:
        print "biosdevname is already of expected version"
        return
    execute(upgrade_biosdevname_node, *nodes)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)
Пример #7
0
def upgrade_kernel_all(*tgzs, **kwargs):
    """creates repo and upgrades kernel in Ubuntu"""
    reboot = kwargs.get('reboot', 'yes')
    execute('create_installer_repo')
    execute('create_install_repo', *tgzs)
    nodes = []
    kernel_ver = kwargs.get('version')
    with settings(host_string=env.roledefs['all'][0], warn_only=True):
        dist, version, extra = get_linux_distro()
        if version == '12.04':
            (package, os_type) = ('linux-image-3.13.0-34-generic', 'ubuntu')
            default_grub='Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-34-generic'
        elif version == '14.04':
            if kernel_ver is None:
                kernel_ver='3.13.0-85'
            (package, os_type) = ('linux-image-'+kernel_ver+'-generic', 'ubuntu')
            default_grub='Advanced options for Ubuntu>Ubuntu, with Linux '+kernel_ver+'-generic'
        elif 'centos linux' in dist.lower() and version.startswith('7'):
            (package, os_type) = ('kernel-3.10.0-327.10.1.el7.x86_64', 'centoslinux')
        elif 'red hat' in dist.lower() and version.startswith('7'):
            (package, os_type) = ('kernel-3.10.0-327.10.1.el7.x86_64', 'redhat')
        else:
            raise RuntimeError("Unsupported platfrom (%s, %s, %s) for"
                               " kernel upgrade." % (dist, version, extra))
    nodes = get_nodes_to_upgrade_pkg(package, os_type, *env.roledefs['all'])
    if not nodes:
        print "kernel is already of expected version"
        return
    execute(upgrade_kernel_node, *nodes, **kwargs)
    if reboot == 'yes':
        node_list_except_build = list(nodes)
        if env.host_string in nodes:
            node_list_except_build.remove(env.host_string)
            reboot_nodes(*node_list_except_build)
            reboot_nodes(env.host_string)
        else:
            reboot_nodes(*nodes)