~ubuntu-branches/debian/stretch/fuel-agent/stretch

« back to all changes in this revision

Viewing changes to fuel_agent/utils/grub.py

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2016-03-16 17:12:17 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20160316171217-p5b360dfuxm5yidy
Tags: 9.0~0+2016.03.09.git.b1ba4b7747+dfsg1-1
* New upstream release based on commit b1ba4b7747.
* Uploading to unstable.
* Lots of tweaks to make Debian provisionning works.
* Standards-Version: 3.9.7 (no change).

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
 
199
199
 
200
200
def grub1_cfg(kernel=None, initrd=None,
201
 
              kernel_params='', chroot='', grub_timeout=5):
 
201
              kernel_params='', chroot='', grub_timeout=10):
202
202
 
203
203
    if not kernel:
204
204
        kernel = guess_kernel(chroot=chroot)
227
227
        utils.execute(*cmd, run_as_root=True, check_exit_code=[0])
228
228
 
229
229
 
230
 
def grub2_cfg(kernel_params='', chroot='', grub_timeout=5):
 
230
def grub2_cfg(kernel_params='', chroot='', grub_timeout=10):
231
231
    grub_defaults = chroot + guess_grub2_default(chroot=chroot)
232
232
    rekerparams = re.compile(r'^.*GRUB_CMDLINE_LINUX=.*')
233
 
    retimeout = re.compile(r'^.*GRUB_HIDDEN_TIMEOUT=.*')
 
233
    retimeout = re.compile(r'^.*GRUB_TIMEOUT=.*')
 
234
    rehidtimeout = re.compile(r'^.*GRUB_HIDDEN_TIMEOUT.*')
234
235
    new_content = ''
235
236
    with open(grub_defaults) as f:
236
237
        for line in f:
237
238
            line = rekerparams.sub(
238
239
                'GRUB_CMDLINE_LINUX="{kernel_params}"'.
239
240
                format(kernel_params=kernel_params), line)
240
 
            line = retimeout.sub('GRUB_HIDDEN_TIMEOUT={grub_timeout}'.
 
241
            line = retimeout.sub('GRUB_TIMEOUT={grub_timeout}'.
241
242
                                 format(grub_timeout=grub_timeout), line)
242
 
            new_content += line
 
243
            if not rehidtimeout.search(line):
 
244
                new_content += line
243
245
    # NOTE(agordeev): explicitly add record fail timeout, in order to
244
246
    # prevent user confirmation appearing if unexpected reboot occured.
245
247
    new_content += '\nGRUB_RECORDFAIL_TIMEOUT={grub_timeout}\n'.\