""" Triggers an upload process with the specified raw.xz URL. """

import argparse
import logging
import logging.config
import multiprocessing.pool

import fedmsg.config
import fedimg.uploader

logging.config.dictConfig(fedmsg.config.load_config()['logging'])
log = logging.getLogger('fedmsg')


def trigger_upload(compose_id, url, push_notifications):
    upload_pool = multiprocessing.pool.ThreadPool(processes=4)
    compose_meta = {'compose_id': compose_id}
    fedimg.uploader.upload(upload_pool, [url], compose_meta=compose_meta,
            push_notifications=push_notifications)


def get_args():
    parser = argparse.ArgumentParser(
        description="Trigger a manual upload process with the "
                    "specified raw.xz URL")
    parser.add_argument(
        "-u", "--url", type=str, help=".raw.xz URL", required=True)
    parser.add_argument(
        "-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
        required=True)
    parser.add_argument(
        "-p", "--push-notifications",
        help="Bool to check if we need to push fedmsg notifications",
        action="store_true", required=False)
    args = parser.parse_args()

    return args.url, args.compose_id, args.push_notifications


def main():
    url, compose_id, push_notifications = get_args()
    trigger_upload(url, compose_id, push_notifications)

if __name__ == '__main__':
    main()

""" Triggers an upload process with the specified raw.xz URL. """

import argparse
import logging
import logging.config
import multiprocessing.pool

import fedmsg.config
import fedimg.uploader

logging.config.dictConfig(fedmsg.config.load_config()['logging'])
log = logging.getLogger('fedmsg')


def trigger_upload(compose_id, url, push_notifications):
    upload_pool = multiprocessing.pool.ThreadPool(processes=4)
    fedimg.uploader.upload(upload_pool, [url],
                           compose_id=compose_id,
                           push_notifications=push_notifications)


def get_args():
    parser = argparse.ArgumentParser(
        description="Trigger a manual upload process with the "
                    "specified raw.xz URL")
    parser.add_argument(
        "-u", "--url", type=str, help=".raw.xz URL", required=True)
    parser.add_argument(
        "-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
        required=True)
    parser.add_argument(
        "-p", "--push-notifications",
        help="Bool to check if we need to push fedmsg notifications",
        action="store_true", required=False)
    args = parser.parse_args()

    return args.url, args.compose_id, args.push_notifications


def main():
    url, compose_id, push_notifications = get_args()
    trigger_upload(url, compose_id, push_notifications)

if __name__ == '__main__':
    main()

Fix the script to send proper format of compose id
scripts: Fix the script to send proper format of compose id

Signed-off-by: Sayan Chowdhury <5f0367a2b3b757615b57f51d912cf16f2c0ad827@gmail.com>

  """ Triggers an upload process with the specified raw.xz URL. """
  
  import argparse
  import logging
  import logging.config
  import multiprocessing.pool
  
  import fedmsg.config
  import fedimg.uploader
  
  logging.config.dictConfig(fedmsg.config.load_config()['logging'])
  log = logging.getLogger('fedmsg')
  
  
  def trigger_upload(compose_id, url, push_notifications):
      upload_pool = multiprocessing.pool.ThreadPool(processes=4)
-     compose_meta = {'compose_id': compose_id}
-     fedimg.uploader.upload(upload_pool, [url], compose_meta=compose_meta,
+     fedimg.uploader.upload(upload_pool, [url],
+                            compose_id=compose_id,
-             push_notifications=push_notifications)
+                            push_notifications=push_notifications)
  
  
  def get_args():
      parser = argparse.ArgumentParser(
          description="Trigger a manual upload process with the "
                      "specified raw.xz URL")
      parser.add_argument(
          "-u", "--url", type=str, help=".raw.xz URL", required=True)
      parser.add_argument(
          "-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
          required=True)
      parser.add_argument(
          "-p", "--push-notifications",
          help="Bool to check if we need to push fedmsg notifications",
          action="store_true", required=False)
      args = parser.parse_args()
  
      return args.url, args.compose_id, args.push_notifications
  
  
  def main():
      url, compose_id, push_notifications = get_args()
      trigger_upload(url, compose_id, push_notifications)
  
  if __name__ == '__main__':
      main()
  
Fix the script to send proper format of compose id
## Code Before:
""" Triggers an upload process with the specified raw.xz URL. """

import argparse
import logging
import logging.config
import multiprocessing.pool

import fedmsg.config
import fedimg.uploader

logging.config.dictConfig(fedmsg.config.load_config()['logging'])
log = logging.getLogger('fedmsg')


def trigger_upload(compose_id, url, push_notifications):
    upload_pool = multiprocessing.pool.ThreadPool(processes=4)
    compose_meta = {'compose_id': compose_id}
    fedimg.uploader.upload(upload_pool, [url], compose_meta=compose_meta,
            push_notifications=push_notifications)


def get_args():
    parser = argparse.ArgumentParser(
        description="Trigger a manual upload process with the "
                    "specified raw.xz URL")
    parser.add_argument(
        "-u", "--url", type=str, help=".raw.xz URL", required=True)
    parser.add_argument(
        "-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
        required=True)
    parser.add_argument(
        "-p", "--push-notifications",
        help="Bool to check if we need to push fedmsg notifications",
        action="store_true", required=False)
    args = parser.parse_args()

    return args.url, args.compose_id, args.push_notifications


def main():
    url, compose_id, push_notifications = get_args()
    trigger_upload(url, compose_id, push_notifications)

if __name__ == '__main__':
    main()

## Instruction:
Fix the script to send proper format of compose id
## Code After:
""" Triggers an upload process with the specified raw.xz URL. """

import argparse
import logging
import logging.config
import multiprocessing.pool

import fedmsg.config
import fedimg.uploader

logging.config.dictConfig(fedmsg.config.load_config()['logging'])
log = logging.getLogger('fedmsg')


def trigger_upload(compose_id, url, push_notifications):
    upload_pool = multiprocessing.pool.ThreadPool(processes=4)
    fedimg.uploader.upload(upload_pool, [url],
                           compose_id=compose_id,
                           push_notifications=push_notifications)


def get_args():
    parser = argparse.ArgumentParser(
        description="Trigger a manual upload process with the "
                    "specified raw.xz URL")
    parser.add_argument(
        "-u", "--url", type=str, help=".raw.xz URL", required=True)
    parser.add_argument(
        "-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
        required=True)
    parser.add_argument(
        "-p", "--push-notifications",
        help="Bool to check if we need to push fedmsg notifications",
        action="store_true", required=False)
    args = parser.parse_args()

    return args.url, args.compose_id, args.push_notifications


def main():
    url, compose_id, push_notifications = get_args()
    trigger_upload(url, compose_id, push_notifications)

if __name__ == '__main__':
    main()
