Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cmonty14 opened this issue Jul 17, 2023 · 0 comments
Open

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

cmonty14 opened this issue Jul 17, 2023 · 0 comments

Comments

@cmonty14
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant