Support a dry run of payload generation.

If a dryrun is specified, the generated payload is neither signed nor
uploaded.

BUG=chromium:1065500
TEST=./run_tests

Change-Id: Ie1ce1489984831e420db3dd842163d7284e5075b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2149956
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: George Engelbrecht <engeg@google.com>
Commit-Queue: Navil Perez <navil@google.com>
Tested-by: Navil Perez <navil@google.com>
diff --git a/api/controller/payload.py b/api/controller/payload.py
index 8b7e934..e273f21 100644
--- a/api/controller/payload.py
+++ b/api/controller/payload.py
@@ -71,14 +71,18 @@
   # Find the value of bucket or default to 'chromeos-releases'.
   destination_bucket = input_proto.bucket or 'chromeos-releases'
 
+  if input_proto.dryrun:
+    keyset = ''
+    upload = False
+  else:
+    keyset = input_proto.keyset
+    upload = True
+
   # There's a potential that some paygen_lib library might raise here, but since
   # we're still involved in config we'll keep it before the validate_only.
-  payload_config = payload.PayloadConfig(
-      tgt_image,
-      src_image,
-      destination_bucket,
-      input_proto.verify,
-      input_proto.keyset)
+  payload_config = payload.PayloadConfig(tgt_image, src_image,
+                                         destination_bucket, input_proto.verify,
+                                         keyset, upload)
 
   # If configured for validation only we're done here.
   if config.validate_only: