aboutsummaryrefslogtreecommitdiffstats
path: root/contrail-keystone-auth/hooks/charmhelpers/core/kernel_factory/ubuntu.py
blob: 3de372fd3df38fe151cf79243f129cb504516f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import subprocess


def persistent_modprobe(module):
    """Load a kernel module and configure for auto-load on reboot."""
    with open('/etc/modules', 'r+') as modules:
        if module not in modules.read():
            modules.write(module + "\n")


def update_initramfs(version='all'):
    """Updates an initramfs image."""
    return subprocess.check_call(["update-initramfs", "-k", version, "-u"])