Use slurp module to fetch remote file content

The slurp module will fetch as b64 the content of remote file.
Using slurp allows working in relative path like other modules, instead
of trying absolute paths in a lookup.

Change-Id: I773819d1d17fb6faaedacf73dea8f645b3cb9699
This commit is contained in:
Guillaume Boutry 2024-02-01 21:57:24 +01:00
parent 75f5dc5a7b
commit dabd9d676c
No known key found for this signature in database
GPG Key ID: E95E3326872E55DE

View File

@ -37,10 +37,17 @@
dest: "{{ zuul.project.src_dir }}/{{ charm_build_name }}"
remote_src: true
- name: Read metadata.yaml
slurp:
src: "{{ zuul.project.src_dir }}/{{ charm_build_name }}/metadata.yaml"
register: metadata_file
- name: Parse metadata.yaml
set_fact:
metadata: "{{ metadata_file.content | b64decode | from_yaml }}"
- name: Upload oci-image to charmhub
register: upload_oci_image_output
vars:
metadata: "{{ lookup('file', zuul.executor.work_root + '/' + zuul.project.src_dir + '/' + charm_build_name + '/metadata.yaml') | from_yaml }}"
args:
executable: /bin/bash
shell: |