Add astute-version argument to astute-rsync

Astute gem filename needs to match the name on master node in order for
astute container to run updated code.

Change-Id: I2ad3e4c7e879c3228db3e76a54b19996bc821455
Closes-Bug: #1514740
This commit is contained in:
Maciej Kwiek 2015-11-10 10:38:57 +01:00
parent e7ec7e839a
commit b4b82ddae4
1 changed files with 18 additions and 1 deletions

View File

@ -61,7 +61,8 @@ class Rsync(DockerAstuteMixin, docker.RsyncCommand, docker.ShellCommand):
"""Rsync local directory to the Docker container."""
gemspec = 'astute.gemspec'
gemfile = 'astute-6.1.0.gem'
gemfile_template = 'astute-{}.gem'
gemfile = 'astute-8.0.0.gem'
@property
def source_path(self):
@ -72,6 +73,7 @@ class Rsync(DockerAstuteMixin, docker.RsyncCommand, docker.ShellCommand):
return 'tmp/%s' % self.gemfile
def pre_sync(self, parsed_args):
self._update_gemfile(parsed_args.astute_version)
self.build_gem(parsed_args.source)
def post_sync(self, parsed_args):
@ -101,6 +103,21 @@ class Rsync(DockerAstuteMixin, docker.RsyncCommand, docker.ShellCommand):
six.print_(e.output)
raise
def get_parser(self, prog_name):
parser = super(Rsync, self).get_parser(prog_name)
parser.add_argument(
'-a', '--astute-version',
default='8.0.0',
help=('Astute gem version (default: 8.0.0). '
'Change if master node version is changed.')
)
return parser
def _update_gemfile(self, version):
self.gemfile = self.gemfile_template.format(version)
class RsyncAgent(DockerAstuteMixin, docker.RsyncCommand):
"""Rsync files to the Docker container."""