Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
1  .gitignore
@@ -5,3 +5,4 @@ target/
yadt_config_rpm_maker.egg-info/
.project
.pydevproject
+.DS_Store
View
2  src/config_rpm_maker/__init__.py
@@ -222,7 +222,7 @@ def _prepare_work_dir(self):
os.makedirs(path)
def _get_chunk_size(self, rpms):
- chunk_size = int(config.get('rpm_upload_cmd_chunk_size', 0))
+ chunk_size = int(config.get('rpm_upload_chunk_size', 0))
if chunk_size < 0:
raise Exception("Config param 'rpm_upload_cmd_chunk_size' needs to be greater or equal 0")
View
21 test/configRpmMaker.py
@@ -60,6 +60,27 @@ def test_build_hosts(self):
for host in hosts_to_check:
self.assertRpm(host, rpms, requires=hosts_to_check[host].get('requires', None), provides=hosts_to_check[host].get('provides', None), files=hosts_to_check[host].get('files', None))
+ def test_chunked_uploads(self):
+ old_config = config.get('rpm_upload_cmd')
+ target_file = os.path.abspath(os.path.join(config.get('temp_dir'), 'upload.txt'))
+ if os.path.exists(target_file):
+ os.remove(target_file)
+ cmd_file = os.path.abspath(os.path.join(config.get('temp_dir'), 'upload.sh'))
+ with open(cmd_file, 'w') as f:
+ f.write('#!/bin/bash\ndest=$1 ; shift ; echo "${#@} $@" >> "$dest"')
+
+ os.chmod(cmd_file, 0755)
+ cmd = '%s %s' % (cmd_file, target_file)
+ config.config['rpm_upload_cmd'] = cmd
+ try:
+ ConfigRpmMaker(None, None)._upload_rpms(['a' for x in range(25)])
+ finally:
+ config.config['rpm_upload_cmd'] = old_config
+
+ self.assertTrue(os.path.exists(target_file))
+ with open(target_file) as f:
+ self.assertEqual(f.read(), '10 a a a a a a a a a a\n10 a a a a a a a a a a\n5 a a a a a\n')
+
def _given_config_rpm_maker(self, keep_work_dir = False):
self._cleanup_temp_dir()
self.create_svn_repo()
View
1  yadt-config-rpm-maker.yaml
@@ -7,6 +7,7 @@ custom_dns_searchlist : []
allow_unknown_hosts : true
config_viewer_dir : 'target/tmp/configviewer'
rpm_upload_cmd : '/bin/true'
+rpm_upload_chunk_size : 10
log_level : 'DEBUG'
thread_count : 4
error_log_dir : 'target/tmp/configviewer/errors'

No commit comments for this range

Something went wrong with that request. Please try again.