Re: patches to review to prepare our ansible scripts for fedora-messaging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your comment about the inline dict.

I haven't read that on this list, but it makes sense.  Patch is attached

 Karsten

Am 12.11.19 um 16:36 schrieb Julen Landa Alustiza:
-            body=dict(
-                playbook=self.playbook_path,
-                userid=getlogin(),
-                results=results,
-            ),
+            topic="ansible.playbook.complete",
+            body=dict(playbook=self.playbook_path, userid=getlogin(), results=results),
           )

I think I had read somewhere that we were going to stop using inline dict arrays on yaml.

We have tons of them, but if the plan is to reduce them inlining an not inline dict is the opposite way to go

:)
Julen Landa Alustiza <jlanda@xxxxxxxxxxxxxxxxx>
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
>From bc5e50d6b123e4d5357e4748a59cb895db6ff29b Mon Sep 17 00:00:00 2001
From: Karsten Hopp <karsten@xxxxxxxxxx>
Date: Wed, 13 Nov 2019 11:23:44 +0100
Subject: [PATCH 15/15] don't use inline dict for message body

Signed-off-by: Karsten Hopp <karsten@xxxxxxxxxx>
---
 callback_plugins/fedora_messaging_callback.py | 24 ++++++++++---------
 .../fedora_messaging_callback2.py             | 24 ++++++++++---------
 2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/callback_plugins/fedora_messaging_callback.py b/callback_plugins/fedora_messaging_callback.py
index 372080212..620fe456e 100644
--- a/callback_plugins/fedora_messaging_callback.py
+++ b/callback_plugins/fedora_messaging_callback.py
@@ -64,14 +64,14 @@ class CallbackModule(CallbackBase):
                 try:
                     msg = Message(
                         topic="ansible.playbook.start",
-                        body=dict(
-                            playbook=path,
-                            userid=getlogin(),
-                            extra_vars=play.playbook.extra_vars,
-                            inventory=play.playbook.inventory.host_list,
-                            playbook_checksum=play.playbook.check,
-                            check=play.playbook.check,
-                        ),
+                        body={
+                            'playbook': path,
+                            'userid': getlogin(),
+                            'extra_vars': play.playbook.extra_vars,
+                            'inventory': play.playbook.inventory.host_list,
+                            'playbook_checksum': play.playbook.check,
+                            'check': play.playbook.check
+                        }
                     )
                     publish(msg)
                 except PublishReturned as e:
@@ -90,9 +90,11 @@ class CallbackModule(CallbackBase):
         try:
             msg = Message(
                 topic="ansible.playbook.complete",
-                body=dict(
-                    playbook=self.playbook_path, userid=getlogin(), results=results
-                ),
+                body={
+                    'playbook': self.playbook_path,
+                    'userid': getlogin(),
+                    'results': results
+                )
             )
             publish(msg)
         except PublishReturned as e:
diff --git a/callback_plugins/fedora_messaging_callback2.py b/callback_plugins/fedora_messaging_callback2.py
index 0b08d6b36..dc4176376 100644
--- a/callback_plugins/fedora_messaging_callback2.py
+++ b/callback_plugins/fedora_messaging_callback2.py
@@ -82,14 +82,14 @@ class CallbackModule(CallbackBase):
                 try:
                     msg = Message(
                         topic="ansible.playbook.start",
-                        body=dict(
-                            playbook=path,
-                            userid=getlogin(),
-                            extra_vars=play._variable_manager.extra_vars,
-                            inventory=play._variable_manager._inventory._sources,
-                            playbook_checksum=secure_hash(path),
-                            check=self.play_context.check_mode,
-                        ),
+                        body={
+                            'playbook': path,
+                            'userid': getlogin(),
+                            'extra_vars': play._variable_manager.extra_vars,
+                            'inventory': play._variable_manager._inventory._sources,
+                            'playbook_checksum': secure_hash(path),
+                            'check': self.play_context.check_mode
+                        }
                     )
                     publish(msg)
                 except PublishReturned as e:
@@ -108,9 +108,11 @@ class CallbackModule(CallbackBase):
         try:
             msg = Message(
                 topic="ansible.playbook.complete",
-                body=dict(
-                    playbook=self.playbook_path, userid=getlogin(), results=results
-                ),
+                body={
+                    'playbook': self.playbook_path,
+                    'userid': getlogin(),
+                    'results': results
+                }
             )
             publish(msg)
         except PublishReturned as e:
-- 
2.21.0

_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux