Skip to contentSkip to conversation

bootlinux: add support for "config-kdevops"

RFC PATCH In review Jeff Layton 2 participants 2 messages Aug 17, 2023

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 bootlinux: add support for "config-kdevops"

Currently, you're expected to have a kernel config file with a name like "config-{{ target_linux_config }}". If there isn't one, then the play aborts.

For my use-case, I just want to have a stock config that I periodically update and use regardless of the branch name. If there is a file called config-kdevops in the template directory, use that instead of any version-specific branch.

---
Another alterative would be to allow config-branchname to take precedence, and make this one the fallback when one isn't present.

---
 playbooks/roles/bootlinux/tasks/main.yml | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
playbooks/roles/bootlinux/tasks/main.yml +18 -2
index e90ba60e1edb..488ff7738078 100644
@@ -265,9 +265,25 @@
   run_once: true
   delegate_to: localhost
 
+- name: Check whether config-kdevops exists
+  stat:
+    path: "{{ role_path }}/templates/config-kdevops"
+  register: config_kdevops
+  delegate_to: localhost
+
+- name: Found config-kdevops, using it for template
+  set_fact:
+    linux_config: "config-kdevops"
+  when: config_kdevops.stat.exists
+
+- name: No config-kdevops, looking for {{ target_linux_config }}
+  set_fact:
+    linux_config: "{{ target_linux_config }}"
+  when: not config_kdevops.stat.exists
+
 - name: Copy configuration for Linux {{ target_linux_tree }} on the client side
   template:
-    src: "{{ target_linux_config }}"
+    src: "{{ linux_config }}"
     dest: "{{ target_linux_dir_path }}/.config"
     owner: "{{ data_user }}"
     group: "{{ data_group }}"
@@ -278,7 +294,7 @@
 
 - name: Copy configuration for Linux {{ target_linux_tree }} on the host side
   template:
-    src: "{{ target_linux_config }}"
+    src: "{{ linux_config }}"
     dest: "{{ bootlinux_9p_host_path }}/.config"
     mode: 0644
   tags: [ 'linux', 'git', 'config' ]

---
base-commit: 999512fbd14e577be47aafa8703c367bb0089cdc
change-id: 20230817-config-kdevops-cd742de641fd

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jeff Layton

Currently, you're expected to have a kernel config file with a name like "config-{{ target_linux_config }}". If there isn't one, then the play aborts.

For my use-case, I just want to have a stock config that I periodically update and use regardless of the branch name. If there is a file called config-kdevops in the template directory, use that instead of any version-specific branch.

This is nice!

Quoted 3 lines

---
Another alterative would be to allow config-branchname to take precedence, and make this one the fallback when one isn't present.

Whoever wants that can add that when needed, unless you want to be proactive and just add that now.

Luis