From aad885ba8869b22b848c6b93ac05ad1cc4711b6d Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Mon, 10 Aug 2015 14:07:23 +0200 Subject: [PATCH] Python-fuelclient rsync command added Change-Id: I16aab579c22ede34db135e5ed875daaf710a5608 --- fuel_dev_tools/README.md | 2 +- fuel_dev_tools/pythonclient.py | 39 ++++++++++++++++++++++++++++++++ fuel_dev_tools/shell.py | 3 +++ vagrant/salt/virtualenv/init.sls | 1 - 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 fuel_dev_tools/pythonclient.py diff --git a/fuel_dev_tools/README.md b/fuel_dev_tools/README.md index 44e2145..086f1f2 100644 --- a/fuel_dev_tools/README.md +++ b/fuel_dev_tools/README.md @@ -6,7 +6,7 @@ Command-line interface for interacting with Fuel Master node. ## Global options -### `--IP`, `-P|--port`, `-U|--user` +### `--IP`, `-p|--port`, `-U|--user` Specify IP, port and user of the Fuel master ISO (default is `10.20.0.2`). diff --git a/fuel_dev_tools/pythonclient.py b/fuel_dev_tools/pythonclient.py new file mode 100644 index 0000000..62bbba1 --- /dev/null +++ b/fuel_dev_tools/pythonclient.py @@ -0,0 +1,39 @@ +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +from fuel_dev_tools import command +from fuel_dev_tools import rsync +from fuel_dev_tools import ssh + + +class Rsync(rsync.RsyncMixin, + ssh.SSHMixin, + command.BaseCommand): + """Rsync local CLI directory to the main machine.""" + + def take_action(self, parsed_args): + source_dir = os.path.join(parsed_args.source, 'fuelclient/') + + # Target is in /usr/lib/python2.6/site-packages/fuelclient + target_dir = os.path.join( + '/usr', 'lib', 'python2.6', 'site-packages', 'fuelclient' + ) + + target, args = self.build_app_args_target(target_dir) + + self.print_debug('Rsyncing to master') + self.rsync(source_dir, target, *args) + diff --git a/fuel_dev_tools/shell.py b/fuel_dev_tools/shell.py index 4156f38..b6fa4f4 100644 --- a/fuel_dev_tools/shell.py +++ b/fuel_dev_tools/shell.py @@ -37,6 +37,7 @@ from fuel_dev_tools.slaves import mcagent from fuel_dev_tools import exc from fuel_dev_tools import info from fuel_dev_tools import puppet +from fuel_dev_tools import pythonclient from fuel_dev_tools import ssh @@ -89,6 +90,8 @@ COMMANDS = { 'puppet-rsync': puppet.Rsync, + 'pythonclient-rsync': pythonclient.Rsync, + 'rabbitmq-id': rabbitmq.Id, 'rabbitmq-config': rabbitmq.Config, 'rabbitmq-dir': rabbitmq.Dir, diff --git a/vagrant/salt/virtualenv/init.sls b/vagrant/salt/virtualenv/init.sls index dad65fa..1edb494 100644 --- a/vagrant/salt/virtualenv/init.sls +++ b/vagrant/salt/virtualenv/init.sls @@ -8,7 +8,6 @@ fuel-virtualenv-dir: fuel-virtualenv: virtualenv.managed: - name: {{ pillar['HOME'] }}/.virtualenvs/fuel - - group: {{ pillar['GROUP'] }} - user: {{ pillar['USER'] }} - require: - file: fuel-virtualenv-dir