Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use rpm_upload_cmd_chunk_size to determine the chunk size for repo up…

…loads
  • Loading branch information...
commit 2ea601fe040f1dd20516e4f69f2fa23798a90d8e 1 parent 13fafaf
@heroldus heroldus authored
Showing with 21 additions and 12 deletions.
  1. +21 −12 src/config_rpm_maker/__init__.py
View
33 src/config_rpm_maker/__init__.py
@@ -152,19 +152,17 @@ def _build_hosts(self, hosts):
def _upload_rpms(self, rpms):
rpm_upload_cmd = config.get('rpm_upload_cmd')
- one_call = config.get('rpm_upload_cmd_one_call', True)
+ chunk_size = self._get_chunk_size(rpms)
+
if rpm_upload_cmd:
- if one_call:
- cmd = '%s %s' % (rpm_upload_cmd, ' '.join(rpms))
- returncode = subprocess.call(cmd, shell=True)
- if returncode:
- raise Exception('Could not upload rpms. Called %s . Returned: %d', (cmd, returncode))
- else:
- for rpm in rpms:
- cmd = '%s %s' % (rpm_upload_cmd, rpm)
- returncode = subprocess.call(cmd, shell=True)
- if returncode:
- raise Exception('Could not upload rpm. Called %s . Returned: %d', (cmd, returncode))
+ pos = 0
+ while pos < len(rpms):
+ rpm_chunk = rpms[pos:pos + chunk_size]
+ cmd = '%s %s' % (rpm_upload_cmd, ' '.join(rpm_chunk))
+ returncode = subprocess.call(cmd, shell=True)
+ if returncode:
+ raise Exception('Could not upload rpms. Called %s . Returned: %d', (cmd, returncode))
+ pos += chunk_size
def _get_affected_hosts(self, change_set, available_host):
result = set()
@@ -223,6 +221,17 @@ def _prepare_work_dir(self):
if not os.path.exists(path):
os.makedirs(path)
+ def _get_chunk_size(self, rpms):
+ chunk_size = int(config.get('rpm_upload_cmd_chunk_size', 0))
+ if chunk_size < 0:
+ raise Exception("Config param 'rpm_upload_cmd_chunk_size' needs to be greater or equal 0")
+
+ if not chunk_size:
+ chunk_size = len(rpms)
+
+ return chunk_size
+
+
def mainMethod():
if len(sys.argv) < 3:
raise Exception("You need to provide at least 2 parameters (repo dir, revision). Was %s " % str(sys.argv))
Please sign in to comment.
Something went wrong with that request. Please try again.