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

Add template_yaml parameter to zabbix_template module #1157

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

masa-orca
Copy link
Collaborator

@masa-orca masa-orca commented Jan 5, 2024

SUMMARY
  • Adding template_yaml parameter to zabbix_template module.
  • Using configuration.importcompare to compare template file(not only yaml but also json and xml) with Zabbix current configurations.
  • Removing unused functions.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • zabbix_template
ADDITIONAL INFORMATION
  • A type of template_json is not file but json. Therefore, I cloudn't combine template_XXX parameter to a parameter.
  • I cloudn't understand that Filter the template json to contain only the keys we will update in filter_template function is needed or not. Let me know if need.

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0fc65a5) 79.75% compared to head (5db97f9) 79.54%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1157      +/-   ##
==========================================
- Coverage   79.75%   79.54%   -0.21%     
==========================================
  Files          34       34              
  Lines        4307     4278      -29     
  Branches     1149     1134      -15     
==========================================
- Hits         3435     3403      -32     
- Misses        517      518       +1     
- Partials      355      357       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flowerysong
Copy link
Contributor

I don't have the time to test it right now, but this shouldn't be necessary.

The point of the json argument type is that it ensures that what the module receives is a consistent format regardless of whether it started as a JSON string or a data structure, so instead of complicating the module interface all you should have to do is convert the file from YAML:

    - name: Import Zabbix template from YAML file.
      community.zabbix.zabbix_template:
        template_json: "{{ lookup('file', 'template4_60_higher.yaml') | from_yaml }}"
        state: present
      register: import_template_yaml

@masa-orca
Copy link
Collaborator Author

@flowerysong Thank you fo your response. I understood it is not necessary. However, it is a temporally workaround that you mentioned way, isn't it?

If this pull request is waste, I'll close it.

@pyrodie18 pyrodie18 requested a review from BGmot January 10, 2024 13:21
Copy link
Collaborator

@BGmot BGmot left a comment

Choose a reason for hiding this comment

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

Changelog fragment please?

@masa-orca masa-orca force-pushed the template_file branch 2 times, most recently from 465924b to 5db97f9 Compare January 10, 2024 14:26
@BGmot BGmot merged commit d1b44e4 into ansible-collections:main Jan 10, 2024
52 of 53 checks passed
@masa-orca masa-orca deleted the template_file branch January 13, 2024 14:56
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.

3 participants