Merge "Wait for DB to reflect group UUID updates"
diff --git a/jeepyb/cmd/notify_impact.py b/jeepyb/cmd/notify_impact.py
index 2214ffb..7038c8f 100644
--- a/jeepyb/cmd/notify_impact.py
+++ b/jeepyb/cmd/notify_impact.py
@@ -91,7 +91,7 @@
               'but I am in dry run mode' % subscriber)
 
 
-def create_bug(git_log, args, lp_project, subscribers):
+def create_bug(git_log, args, lp_project, config):
     """Create a bug for a change.
 
     Create a launchpad bug in lp_project, titled with the first line of
@@ -127,23 +127,22 @@
 
         # If the author of the merging patch matches our configured
         # subscriber lists, then subscribe the configured victims.
-        for email_address in subscribers.get('author_map', {}):
+        for email_address in config.get('author_map', {}):
             email_re = re.compile('^Author:.*%s.*' % email_address)
             for line in bug_descr.split('\n'):
                 m = email_re.match(line)
                 if m:
-                    author_class = subscribers['author_map'][email_address]
+                    author_class = config['author_map'][email_address]
 
         if author_class:
-            subscribers = \
-                subscribers.get('subscriber_map', {}).get(author_class, [])
-            for subscriber in subscribers:
+            config = config.get('subscriber_map', {}).get(author_class, [])
+            for subscriber in config:
                 actions.subscribe(buginfo, subscriber)
 
     return buglink
 
 
-def process_impact(git_log, args, subscribers):
+def process_impact(git_log, args, config):
     """Process DocImpact flag.
 
     If the 'DocImpact' flag is present for a change that is merged,
@@ -154,7 +153,7 @@
     """
     if args.impact.lower() == 'docimpact':
         if args.hook == "change-merged":
-            create_bug(git_log, args, 'openstack-manuals', subscribers)
+            create_bug(git_log, args, 'openstack-manuals', config)
         return
 
     email_content = EMAIL_TEMPLATE % (args.impact,
@@ -207,8 +206,8 @@
     parser.add_argument('--impact', default=None)
     parser.add_argument('--dest-address', default=None)
 
-    # Automatic subscribers
-    parser.add_argument('--auto-subscribers', type=argparse.FileType('r'),
+    # Automatic config
+    parser.add_argument('--config', type=argparse.FileType('r'),
                         default=None)
 
     # Don't actually create the bug
@@ -241,16 +240,16 @@
     # Where the entries in the author map are email addresses
     # to match in author lines, and the subscriber map is a
     # list of launchpad user ids.
-    subscribers = {}
-    if args.auto_subscribers:
-        subscribers = yaml.load(args.auto_subscribers.read())
+    config = {}
+    if args.config:
+        config = yaml.load(args.config.read())
 
     # Get git log
     git_log = extract_git_log(args)
 
     # Process impacts found in git log
     if impacted(git_log, args.impact):
-        process_impact(git_log, args, subscribers)
+        process_impact(git_log, args, config)
 
 if __name__ == "__main__":
     main()
diff --git a/jeepyb/cmd/welcome_message.py b/jeepyb/cmd/welcome_message.py
index 31df892..03278cc 100644
--- a/jeepyb/cmd/welcome_message.py
+++ b/jeepyb/cmd/welcome_message.py
@@ -60,6 +60,7 @@
     data = cursor.fetchone()
     if data:
         if data[0] == "1":
+            logger.info('We found a newbie: %s', uploader)
             return True
         else:
             return False
@@ -131,11 +132,15 @@
     # for Welcome Message
     parser.add_argument('user', help='The gerrit admin user')
     parser.add_argument('ssh_key', help='The gerrit admin SSH key file')
+    # Don't actually post the message
+    parser.add_argument('--dryrun', dest='dryrun', action='store_true')
+    parser.add_argument('--no-dryrun', dest='dryrun', action='store_false')
+    parser.set_defaults(dryrun=False)
 
     args = parser.parse_args()
 
     # they're a first-timer, post the message on 1st patchset
-    if is_newbie(args.uploader) and args.patchset == 1:
+    if is_newbie(args.uploader) and args.patchset == 1 and not args.dryrun:
         post_message(args.change, args.user, args.ssh_key)
 
 if __name__ == "__main__":