Rename upload_rss and move non-swift-relevant parts into the main method

Change-Id: I4b15dafc48b7f14bb88fde0b7ee9af3de0422e75
diff --git a/jeepyb/cmd/openstackwatch.py b/jeepyb/cmd/openstackwatch.py
index 80eab93..945674d 100644
--- a/jeepyb/cmd/openstackwatch.py
+++ b/jeepyb/cmd/openstackwatch.py
@@ -111,11 +111,7 @@
         yield json_row
 
 
-def upload_rss(xml, output_object):
-    if 'swift' not in CONFIG:
-        print(xml)
-        return
-
+def upload_to_swift(content, objectname):
     import swiftclient
     cfg = CONFIG['swift']
     client = swiftclient.Connection(cfg['auth_url'],
@@ -130,8 +126,8 @@
         # eventual consistenties
         time.sleep(1)
 
-    client.put_object(cfg['container'], output_object,
-                      cStringIO.StringIO(xml))
+    client.put_object(cfg['container'], objectname,
+                      cStringIO.StringIO(content))
 
 
 def generate_rss(content, project=""):
@@ -164,13 +160,19 @@
 
 def main():
     if CONFIG['output_mode'] == "combined":
-        upload_rss(generate_rss(get_json()),
-                   CONFIG['swift']['combined_output_object'])
+        content = generate_rss(get_json())
+        if 'swift' in CONFIG:
+            upload_to_swift(content, CONFIG['swift']['combined_output_object'])
+        else:
+            print(content)
     elif CONFIG['output_mode'] == "multiple":
         for project in CONFIG['projects']:
-            upload_rss(
-                generate_rss(get_json(project), project=project),
-                "%s.xml" % (os.path.basename(project)))
+            content = generate_rss(get_json(project), project=project)
+            if 'swift' in CONFIG:
+                objectname = "%s.xml" % os.path.basename(project)
+                upload_to_swift(content, objectname)
+            else:
+                print(content)
 
 if __name__ == '__main__':
     main()