Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/python2 |
||
2 | |||
3 | # |
||
4 | # create_grub2_bootloader_argument.py |
||
5 | # generate template-based checks for unsuccessful file modifications detailed |
||
6 | |||
7 | |||
8 | from template_common import FilesGenerator, UnknownTargetError |
||
9 | |||
10 | import re |
||
11 | |||
12 | class GRUB2BootloaderArgumentGenerator(FilesGenerator): |
||
13 | def generate(self, target, args): |
||
14 | arg_name, arg_value = args[0:2] |
||
15 | arg_name_value = arg_name + '=' + arg_value |
||
16 | |||
17 | if target == "bash": |
||
18 | self.file_from_template( |
||
19 | "./template_BASH_grub2_bootloader_argument", |
||
20 | { |
||
21 | "ARG_NAME": arg_name, |
||
22 | "ARG_NAME_VALUE": arg_name_value |
||
23 | }, |
||
24 | "./bash/grub2_{0}_argument.sh", arg_name |
||
25 | ) |
||
26 | elif target == "oval": |
||
27 | self.file_from_template( |
||
28 | "./template_OVAL_grub2_bootloader_argument", |
||
29 | { |
||
30 | "ARG_NAME": arg_name, |
||
31 | "ARG_NAME_VALUE": arg_name_value |
||
32 | }, |
||
33 | "./oval/grub2_{0}_argument.xml", arg_name |
||
34 | ) |
||
35 | else: |
||
36 | raise UnknownTargetError(target) |
||
37 | |||
38 | def csv_format(self): |
||
39 | return("CSV should contains lines of the format: " + |
||
40 | "SYSCALL") |
||
41 |