-
Notifications
You must be signed in to change notification settings - Fork 332
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
azure_rm_adapplication_info
- Feature azure rm adapplication info diff
#1560
azure_rm_adapplication_info
- Feature azure rm adapplication info diff
#1560
Conversation
app_diff hinzugefügt
Finalizing modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Add tests for app_diff
modify doc for sentry test
documentation modify examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheNotorioursRMM Please take a look, Small change request! Thanks!
|
||
- name: Assert the difference | ||
ansible.builtin.assert: | ||
that: diff_output.app_diff[0].app_display_name == "{{ display_name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation: expected 6 but found 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this issue..
The indentaton is the same as in line 84, 85 and 86?
@@ -94,4 +104,4 @@ | |||
- name: Assert there is no application | |||
ansible.builtin.assert: | |||
that: | |||
- output.applications | length == 0 | |||
- output.applications | length == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No new line character at the end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New commit: Fixed in 1 line.
@@ -149,7 +229,8 @@ def __init__(self): | |||
app_id=dict(type='str'), | |||
object_id=dict(type='str'), | |||
identifier_uri=dict(type='str'), | |||
app_display_name=dict(type='str') | |||
app_display_name=dict(type='str'), | |||
app_diff=dict(type='list', elements='dict') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If defined this way, it will be easier to understand!
app_diff=dict(type='list', elements='dict') | |
app_diff=dict(type='list', | |
elements='dict', | |
options=dict( | |
app_id=dict(type='str'), | |
app_display_name=dict(type='str') | |
) | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I have the configuration of my adapps in a YAML or JSON file, I don't want to edit it additionally. I want to provide it directly to the plugin, not just the "app_display_name" or the "app_id". However, if I provide this as an option, I have to filter the YAML or JSON for these two options, which means another Ansible task in the playbook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But your code only handles these two fields and no other fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code need one of these fields, the other fields will be ignored. In the future with this way, it's possible to check the diffrence of any field and to update them.
So I can write the full config for the AD App by code, check it with the app_diff option and create, update or delete the applications with the existing module "azure_rm_adapplication.py".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. The code only handles these two fields. However, I can provide a YAML or JSON that contains the entire content of multiple ADAPPs in a list without it being blocked. This way, I can directly compare my stored configuration of the ADAPPs without having to parse it again, create a list, and pass the values into a variable
if app.get("app_id") == diff.get("app_id") or app.get("app_display_name") == diff.get("app_display_name"): | ||
found = True | ||
break | ||
if not found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a definition error? Add to 'app_diff' if it should be True! Thank you!
if not found: | |
if found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that is correct. It compares the provided list with the production Azure data, and if something is not present in the production environment, the status "absent" is added. This way, you can immediately reuse the return to delete the adapps that do not belong in the production environment using "plugins/modules/azure_rm_adapplication.py".
This allows you to first add adapps with "plugins/modules/azure_rm_adapplication.py" and then use "plugins/modules/azure_rm_adapplication_info.py" (option diff) to identify the adapps that should not be in the live environment and subsequently delete them with "plugins/modules/azure_rm_adapplication.py".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, please fix the following error, and make a detailed definition of the parameter definition. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have adjusted the documentation and re-added the NOT.
kindly ping! |
….yml Fix: No new line character at the end of file
@TheNotoriousRMM Please help solve the conflicts I will review and push forward the merger as soon as possible. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small change request!
tests/integration/targets/azure_rm_adapplication/tasks/main.yml
Outdated
Show resolved
Hide resolved
- name: get ad app diff ---- by display name | ||
azure_rm_adapplication_info: | ||
app_diff: | ||
- app_display_name: "{{ display_name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation: expected 6 but found 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix wrong indentation
azure_rm_adapplication_info: | ||
app_diff: | ||
- app_display_name: "{{ display_name }}" | ||
- app_id: "{{ app_id }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation: expected 6 but found 8
if app.get("app_id") == diff.get("app_id") or app.get("app_display_name") == diff.get("app_display_name"): | ||
found = True | ||
break | ||
if not found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, please fix the following error, and make a detailed definition of the parameter definition. Thank you!
Add new documentation for the option app_diff
Fix wrong indentation
@@ -149,7 +229,8 @@ def __init__(self): | |||
app_id=dict(type='str'), | |||
object_id=dict(type='str'), | |||
identifier_uri=dict(type='str'), | |||
app_display_name=dict(type='str') | |||
app_display_name=dict(type='str'), | |||
app_diff=dict(type='list', elements='dict') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. The code only handles these two fields. However, I can provide a YAML or JSON that contains the entire content of multiple ADAPPs in a list without it being blocked. This way, I can directly compare my stored configuration of the ADAPPs without having to parse it again, create a list, and pass the values into a variable
if app.get("app_id") == diff.get("app_id") or app.get("app_display_name") == diff.get("app_display_name"): | ||
found = True | ||
break | ||
if not found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have adjusted the documentation and re-added the NOT.
- name: get ad app diff ---- by display name | ||
azure_rm_adapplication_info: | ||
app_diff: | ||
- app_display_name: "{{ display_name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix wrong indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please!
tests/integration/targets/azure_rm_adapplication/tasks/main.yml
Outdated
Show resolved
Hide resolved
I hope this will resolve the issue. Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change accepted
@@ -94,4 +104,4 @@ | |||
- name: Assert there is no application | |||
ansible.builtin.assert: | |||
that: | |||
- output.applications | length == 0 | |||
- output.applications | length == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New commit: Fixed in 1 line.
|
||
- name: Assert the difference | ||
ansible.builtin.assert: | ||
that: diff_output.app_diff[0].app_display_name == "{{ display_name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this issue..
The indentaton is the same as in line 84, 85 and 86?
@@ -149,7 +229,8 @@ def __init__(self): | |||
app_id=dict(type='str'), | |||
object_id=dict(type='str'), | |||
identifier_uri=dict(type='str'), | |||
app_display_name=dict(type='str') | |||
app_display_name=dict(type='str'), | |||
app_diff=dict(type='list', elements='dict') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code need one of these fields, the other fields will be ignored. In the future with this way, it's possible to check the diffrence of any field and to update them.
So I can write the full config for the AD App by code, check it with the app_diff option and create, update or delete the applications with the existing module "azure_rm_adapplication.py".
@@ -104,4 +121,4 @@ | |||
- name: Assert there is no application | |||
ansible.builtin.assert: | |||
that: | |||
- output.applications | length == 0 | |||
output.applications | length == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same error!
output.applications | length == 0 | |
ansible.builtin.assert: | |
that: output.applications | length == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in a new push
….yml Change No new line character at the end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fix line 124
@TheNotoriousRMM sanity tests still don't work, depending on the editor you're using. The error is as follows:
|
@TheNotoriousRMM Since you did not make any changes in the last line, can you try to undo the changes in the last line? Thank you! |
….yml Undo changes at the last line. Sanity test was OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have undo the changes at the last line. Sanity check was OK.
@TheNotoriousRMM However, judging from the PR content you submitted, you added new lines at the end of the play, as shown below: |
I'm confused.. Can you give me a hint how I can delete this line? |
@TheNotoriousRMM You can avoid this problem by moving the mouse over the last line(vim edit the file and enter insert mode), pressing the 'ESC' key to cancel the new line at the tail and then save, I did this in PR #1616 and the tail line disappeared, sanity pass! Thank you! |
….yml Add new line at the end of the file. Opened in vim and save, the new line automaticly added.
@Fred-sun I have finaly added a new line at the end of the file. Sorry, I thought the last line had to be deleted and not added. I didn't understand you correctly ;) |
@TheNotoriousRMM Thanks for you update! Everything is OK! I will push for merged as soon as possible! |
azure_rm_adapplication_info
- Feature azure rm adapplication info diff
* modified: plugins/modules/azure_rm_adapplication_info.py * modified: plugins/modules/azure_rm_adapplication_info.py app_diff hinzugefügt * modified: plugins/modules/azure_rm_adapplication_info.py Anpassungen * Anpassungen * Anpassungen * modified: plugins/modules/azure_rm_adapplication_info.py Finalizing modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Add tests for app_diff * modified: plugins/modules/azure_rm_adapplication_info.py modify doc for sentry test * modified: plugins/modules/azure_rm_adapplication_info.py documentation modify examples * modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Fix: No new line character at the end of file * modified: plugins/modules/azure_rm_adapplication_info.py Add new documentation for the option app_diff * modified: plugins/modules/azure_rm_adapplication_info.py Fix wrong indentation * Update tests/integration/targets/azure_rm_adapplication/tasks/main.yml I hope this will resolve the issue. Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> * modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Change No new line character at the end of file * modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Undo changes at the last line. Sanity test was OK. * modified: tests/integration/targets/azure_rm_adapplication/tasks/main.yml Add new line at the end of the file. Opened in vim and save, the new line automaticly added. --------- Co-authored-by: MehrR <raphael.mehr@stadtluzern.ch> Co-authored-by: baechir <raphael.baechi@stadtluzern.ch> Co-authored-by: TheRapac <55585899+therapac@users.noreply.github.com> Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
SUMMARY
azure_rm_adapplication_info add option "app_diff" #1559
ISSUE TYPE
COMPONENT NAME
azure_rm_adapplication_info.py
test targets > azure_rm_adapplication > tasks: main
ADDITIONAL INFORMATION