From aa45bd8a94c0b67fa44ea845ea4eff3980385caa Mon Sep 17 00:00:00 2001
From: Marcin Kawa <kawa.macin@gmail.com>
Date: Thu, 15 Sep 2016 16:35:47 +0100
Subject: [PATCH] Fix undefined info error and accept HTTP 201 response code
 (#2643)

Prevent referenced before assignment error when `notify` argument is not specified and accept HTTP 201 (created) code.
---
 notification/campfire.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/notification/campfire.py b/notification/campfire.py
index 7871747becd..3d003e1363a 100644
--- a/notification/campfire.py
+++ b/notification/campfire.py
@@ -117,14 +117,14 @@ def main():
     # Send some audible notification if requested
     if notify:
         response, info = fetch_url(module, target_url, data=NSTR % cgi.escape(notify), headers=headers)
-    if info['status'] != 200:
-        module.fail_json(msg="unable to send msg: '%s', campfire api"
-                            " returned error code: '%s'" %
-                             (notify, info['status']))
+        if info['status'] not in [200, 201]:
+            module.fail_json(msg="unable to send msg: '%s', campfire api"
+                                " returned error code: '%s'" %
+                                 (notify, info['status']))
 
     # Send the message
     response, info = fetch_url(module, target_url, data=MSTR %cgi.escape(msg), headers=headers)
-    if info['status'] != 200:
+    if info['status'] not in [200, 201]:
         module.fail_json(msg="unable to send msg: '%s', campfire api"
                             " returned error code: '%s'" %
                              (msg, info['status']))