Add support for submitting a job into an atomic group to the CLI.

Signed-off-by: Gregory Smith <gps@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3071 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/job.py b/cli/job.py
index 51c13fb..506cc15 100755
--- a/cli/job.py
+++ b/cli/job.py
@@ -206,6 +206,7 @@
     [--reboot_before <option>] [--reboot_after <option>]
     [--noverify] [--timeout <timeout>] [--one-time-hosts <hosts>]
     [--email <email>] [--dependencies <labels this job is dependent on>]
+    [--atomic_group <atomic group name>]
     job_name
 
     Creating a job is rather different from the other create operations,
@@ -240,6 +241,9 @@
                                default='')
         self.parser.add_option('-b', '--labels', help='Comma separated list of '
                                'labels to get machine list from.', default='')
+        self.parser.add_option('-G', '--atomic_group', help='Name of an Atomic '
+                               'Group to schedule this job on.',
+                               default='')
         self.parser.add_option('-m', '--machine', help='List of machines to '
                                'run on')
         self.parser.add_option('-M', '--mlist',
@@ -298,9 +302,10 @@
             return (options, leftover)
 
         if (len(self.hosts) == 0 and not options.one_time_hosts
-            and not options.labels):
+            and not options.labels and not options.atomic_group):
             self.invalid_syntax('Must specify at least one machine '
-                                '(-m, -M, -b or --one-time-hosts).')
+                                'or an atomic group '
+                                '(-m, -M, -b, -G or --one-time-hosts).')
         if not options.control_file and not options.test:
             self.invalid_syntax('Must specify either --test or --control-file'
                                 ' to create a job.')
@@ -366,6 +371,9 @@
         (self.data['hosts'],
          self.data['meta_hosts']) = self.parse_hosts(self.hosts)
 
+        if options.atomic_group:
+            self.data['atomic_group_name'] = options.atomic_group
+
         deps = options.dependencies.split(',')
         deps = [dep.strip() for dep in deps if dep.strip()]
         self.data['dependencies'] = deps