~simpoir/landscape-charm/19.10_version

« back to all changes in this revision

Viewing changes to charmhelpers/core/kernel_factory/centos.py

  • Committer: 🤖 Landscape Builder
  • Author(s): Chad Smith
  • Date: 2017-03-04 03:06:08 UTC
  • mfrom: (382.1.4 landscape-charm)
  • Revision ID: _landscape_builder-20170304030608-lc8tyjw2806tmc4u
Merge add-apt-repository-retries [f=1370933] [r=landscape-builder,ericsnowcurrently] [a=Chad Smith]
Sync of charmhelpers to get updated fetch.add_source which handles 30 retries upon exit 1

Add charmhelpers.osplatform dependency to charm-helpers.yaml

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import subprocess
 
2
import os
 
3
 
 
4
 
 
5
def persistent_modprobe(module):
 
6
    """Load a kernel module and configure for auto-load on reboot."""
 
7
    if not os.path.exists('/etc/rc.modules'):
 
8
        open('/etc/rc.modules', 'a')
 
9
        os.chmod('/etc/rc.modules', 111)
 
10
    with open('/etc/rc.modules', 'r+') as modules:
 
11
        if module not in modules.read():
 
12
            modules.write('modprobe %s\n' % module)
 
13
 
 
14
 
 
15
def update_initramfs(version='all'):
 
16
    """Updates an initramfs image."""
 
17
    return subprocess.check_call(["dracut", "-f", version])