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

feat: support receiving file contents and env vars from EDA Server #711

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

mkanoor
Copy link
Contributor

@mkanoor mkanoor commented Aug 31, 2024

AAP Credential Types support File contents via file injectors.
https://docs.ansible.com/automation-controller/latest/html/userguide/credential_types.html

We create temporary files with the data sent from Server The source plugin can access the temporary file names to access the data.

Supports single file as well as multiple files.

To access the filenames in the source rulebook you can use the following extra vars

  • eda.filename or
  • eda.filename.<<key_name1>>
  • eda.filename.<<key_name2>>

e.g.

- name: Use payload file to check events
  hosts: all
  sources:
    - ansible.eda.generic:
        payload_file: "{{ eda.filename.test_payload_file }}"

The env variables are treated like extra_vars and added to the current processes environment

https://issues.redhat.com/browse/AAP-25519

@mkanoor mkanoor force-pushed the file_contents branch 2 times, most recently from fa11623 to c90f1d3 Compare August 31, 2024 19:12
Copy link
Contributor

@Alex-Izquierdo Alex-Izquierdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions:

  1. Should the CHANGELOG be updated?
  2. Does make sense to support non_fq_key? I feel it would be simpler if filename is filenames and it is always a dict with N nested keys.

Concerns:
I'm concerned about the amount of assumptions that we make from the server side that would end up in unhandled exceptions:

  • template_key can be None,
  • data.get("data") can be None
  • what if len(keys) == 1 and template_key != "template" ?

Alex-Izquierdo
Alex-Izquierdo previously approved these changes Sep 2, 2024
Copy link

@mkanoor mkanoor force-pushed the file_contents branch 3 times, most recently from ee204e7 to 540f785 Compare November 15, 2024 21:30
@mkanoor mkanoor changed the title feat: support receiving file contents from EDA Server feat: support receiving file contents nd env vars from EDA Server Nov 15, 2024
@mkanoor mkanoor changed the title feat: support receiving file contents nd env vars from EDA Server feat: support receiving file contents and env vars from EDA Server Nov 15, 2024
AAP Credential Types support File contents via file
injectors.
https://docs.ansible.com/automation-controller/latest/html/userguide/credential_types.html

We create temporary files with the data sent from Server
The source plugin can access the temporary file names
to access the data.

Supports single file as well as multiple files.

To access the filenames in the source rulebook you can use
the following extra vars

- eda.filename
or
- eda.filename.<<key_name1>>
- eda.filename.<<key_name2>>

e.g.
```
- name: Use payload file to check events
  hosts: all
  sources:
    - ansible.eda.generic:
        payload_file: "{{ eda.filename.test_payload_file }}"
```

The env vars are treated like extra_vars and inserted into the
current processes env
@mkanoor mkanoor merged commit 44618f0 into ansible:main Nov 22, 2024
10 checks passed
zkayyali812 pushed a commit that referenced this pull request Dec 9, 2024
)

AAP Credential Types support File contents via file injectors.

https://docs.ansible.com/automation-controller/latest/html/userguide/credential_types.html

We create temporary files with the data sent from Server The source
plugin can access the temporary file names to access the data.

Supports single file as well as multiple files.

To access the filenames in the source rulebook you can use the following
extra vars

- eda.filename or
- eda.filename.<<key_name1>>
- eda.filename.<<key_name2>>

e.g.
```
- name: Use payload file to check events
  hosts: all
  sources:
    - ansible.eda.generic:
        payload_file: "{{ eda.filename.test_payload_file }}"
```

The env variables are treated like extra_vars and added to the current
processes environment

https://issues.redhat.com/browse/AAP-25519
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

Successfully merging this pull request may close these issues.

6 participants