Skip to content

Commit

Permalink
More usage of absolute paths in salt scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mackdk committed Jun 27, 2024
1 parent 59e4d97 commit 8d6e51a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ mgr_copy_initrd:

{% set loader_type = salt['cmd.run']('if [ -f /etc/sysconfig/bootloader ]; then source /etc/sysconfig/bootloader 2> /dev/null; fi;
if [ -z "${LOADER_TYPE}" ]; then
if [ $(which grubonce 2> /dev/null) ] && [ !$(which grub2-mkconfig 2> /dev/null) ]; then LOADER_TYPE="grub";
elif [ $(which elilo 2> /dev/null) ] && [ !$(which grub2-mkconfig 2> /dev/null) ]; then LOADER_TYPE="elilo";
if [ $(/usr/bin/which grubonce 2> /dev/null) ] && [ !$(/usr/bin/which grub2-mkconfig 2> /dev/null) ]; then LOADER_TYPE="grub";
elif [ $(/usr/bin/which elilo 2> /dev/null) ] && [ !$(/usr/bin/which grub2-mkconfig 2> /dev/null) ]; then LOADER_TYPE="elilo";
fi;
fi; echo "${LOADER_TYPE}"', python_shell=True) %}
{% if loader_type == 'grub' %}
Expand All @@ -27,7 +27,7 @@ mgr_create_grub_entry:
mgr_grub_boot_once:
cmd.run:
- name: grubonce "{{ pillar.get('uyuni-reinstall-name') }}"
- name: /usr/sbin/grubonce "{{ pillar.get('uyuni-reinstall-name') }}"
- onchanges:
- file: mgr_create_grub_entry
{% elif loader_type == 'elilo' %}
Expand Down
4 changes: 2 additions & 2 deletions susemanager-utils/susemanager-sls/salt/bootstrap/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ salt-minion-package:
{# hack until transactional_update.run is fixed to use venv-salt-call #}
{# Writing to the future - find latest etc overlay which was created for package installation and use that as etc root #}
{# this only works here in bootstrap when we are not running in transaction #}
{%- set pending_transaction_id = salt['cmd.run']('snapper --no-dbus list --columns=number | grep "+" | tr -d "+"', python_shell=True) %}
{%- set pending_transaction_id = salt['cmd.run']('/usr/bin/snapper --no-dbus list --columns=number | /usr/bin/grep "+" | tr -d "+"', python_shell=True) %}
{%- if not pending_transaction_id %}
{# if we did not get pending transaction id, write to current upperdir #}
{%- set pending_transaction_id = salt['cmd.run']('snapper --no-dbus list --columns number | grep "*" | tr -d "*"', python_shell=True) %}
{%- set pending_transaction_id = salt['cmd.run']('/usr/bin/snapper --no-dbus list --columns number | /usr/bin/grep "*" | tr -d "*"', python_shell=True) %}
{%- endif %}
{# increase transaction id by 1 since jinja is doing this before new transaction for package install is created #}
{# this is working under assumption there will be only one transaction between jinja render and actual package installation #}
Expand Down
2 changes: 1 addition & 1 deletion susemanager-utils/susemanager-sls/salt/channels/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include:
{%- set is_dnf = salt['pkg.version']("dnf") %}

{%- if is_dnf %}
{%- set dnf_plugins = salt['cmd.run']("find /usr/lib -type d -name dnf-plugins -printf '%T@ %p\n' | sort -nr | cut -d ' ' -s -f 2- | head -n 1", python_shell=True) %}
{%- set dnf_plugins = salt['cmd.run']("/usr/bin/find /usr/lib -type d -name dnf-plugins -printf '%T@ %p\n' | /usr/bin/sort -nr | /usr/bin/cut -d ' ' -s -f 2- | /usr/bin/head -n 1", python_shell=True) %}
{%- if dnf_plugins %}
mgrchannels_susemanagerplugin_dnf:
file.managed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ mgr_buildimage_kiwi_bundle:
# KIWI Legacy
#

{%- set kiwi_help = salt['cmd.run']('kiwi --help') %}
{%- set kiwi_help = salt['cmd.run']('/usr/bin/kiwi --help') %}
{%- set have_bundle_build = kiwi_help.find('--bundle-build') > 0 %}

# i586 build on x86_64 host must be called with linux32
Expand Down Expand Up @@ -141,13 +141,13 @@ mgr_buildimage_kiwi_bundle_dir:

mgr_buildimage_kiwi_bundle_tarball:
cmd.run:
- name: "cd '{{ dest_dir }}' && tar czf '{{ bundle_dir }}'`basename *.packages .packages`-{{ bundle_id }}.tgz --no-recursion `find . -maxdepth 1 -type f`"
- name: "cd '{{ dest_dir }}' && /usr/bin/tar czf '{{ bundle_dir }}'`basename *.packages .packages`-{{ bundle_id }}.tgz --no-recursion `/usr/bin/find . -maxdepth 1 -type f`"
- require:
- file: mgr_buildimage_kiwi_bundle_dir

mgr_buildimage_kiwi_bundle:
cmd.run:
- name: "cd '{{ bundle_dir }}' && sha256sum *.tgz > `echo *.tgz`.sha256"
- name: "cd '{{ bundle_dir }}' && /usr/bin/sha256sum *.tgz > `/usr/bin/echo *.tgz`.sha256"
- require:
- cmd: mgr_buildimage_kiwi_bundle_tarball

Expand Down

0 comments on commit 8d6e51a

Please sign in to comment.