Skip to content

Fetching CSV content fails - could be related to rendering #7

@cmonty14

Description

@cmonty14

Hi,
I have this coding to fetch CSV content from a Git repo and write it in a file:

{% set gitUrl = 'https://git.example.com/api/v1/repos/ABC/stats/raw/exportlocationlist.csv' %}
{% set headers = {"Authorization": "token 1234abcd1234abcd"} %}
{% set contentCsv = salt['http.query'](gitUrl, header_dict=headers)['body'] %}

write_to_file:
  file.managed:
    - name: /tmp/contentCsv
    - contents: {{ contentCsv }}
    - makedirs: True
    - overwrite: True

However this returns error:
Rendering SLS 'base:manager_org_1.stc-test-automnt-manila-backup' failed: could not find expected ':'; line 12

This is an extract of the content of the CSV:

    body:
        TIME;DATE;ID;PATH;PREF;NAME;SID;AZ
        1687174100;19062023-132820;05bc1a8f-3953-4ea7-a716-19631030a669;10.180.2.99:/share_041c6c87_5d87_4cd4_b344_f20bd2164f75;True;backupAM3;am3;eu-de-1d
        1687174100;19062023-132820;eb81e7b7-79fc-41da-9d02-6d1fdda3e10b;10.180.2.107:/share_041c6c87_5d87_4cd4_b344_f20bd2164f75;False;backupAM3;am3;eu-de-1d
        1687240964;20062023-080244;1d1fe0be-0f59-44bf-9139-8768c423192b;10.180.3.242:/share_9d8031f2_68aa_449c_9257_a27b40b17ba2;False;backupAMH;amh;eu-de-2a

My goal is to write the content of field PATH in a variable after selecting PREF=true and NAME=backup where is another variable.

Could you please advise how to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions