diff --git a/solar/core/handlers/ansible_template.py b/solar/core/handlers/ansible_template.py index e0990e89..85170a3a 100644 --- a/solar/core/handlers/ansible_template.py +++ b/solar/core/handlers/ansible_template.py @@ -39,8 +39,7 @@ class AnsibleTemplate(TempFileHandler): self._copy_templates_and_scripts(resource, action_name) self.transport_sync.copy(resource, self.dst, '/tmp') self.transport_sync.copy(resource, '/vagrant/library', '/tmp') - sync_results = self.transport_sync.sync_all() - self.verify_sync_results(sync_results) + self.transport_sync.sync_all() # remote paths are not nested inside solar_local remote_playbook_file = playbook_file.replace( diff --git a/solar/core/handlers/base.py b/solar/core/handlers/base.py index 86d6cb23..e90818ed 100644 --- a/solar/core/handlers/base.py +++ b/solar/core/handlers/base.py @@ -43,15 +43,6 @@ class BaseHandler(object): self.transport_sync.bind_with(self.transport_run) self.transport_run.bind_with(self.transport_sync) - def verify_sync_results(self, results): - for result in results: - if isinstance(result, tuple) and len(result) == 3: - # TODO Include file information in result - rc, out, err = result - log.debug('RC %s OUT %s ERR %s', rc, out, err) - if rc: - raise errors.SolarError(err) - def verify_run_result(self, cmd, result): rc, out, err = result log.debug('CMD %r RC %s OUT %s ERR %s', cmd, rc, out, err) diff --git a/solar/core/handlers/naive_sync.py b/solar/core/handlers/naive_sync.py index 82f87095..c06b7236 100644 --- a/solar/core/handlers/naive_sync.py +++ b/solar/core/handlers/naive_sync.py @@ -27,5 +27,4 @@ class NaiveSync(BaseHandler): # to understand where src comes from for item in args['sources']: self.transport_sync.copy(resource, item['src'], item['dst']) - results = self.transport_sync.sync_all() - self.verify_sync_results(results) + self.transport_sync.sync_all() diff --git a/solar/core/handlers/puppet.py b/solar/core/handlers/puppet.py index baf7fade..524130c9 100644 --- a/solar/core/handlers/puppet.py +++ b/solar/core/handlers/puppet.py @@ -37,8 +37,7 @@ class Puppet(TempFileHandler): self.prepare_templates_and_scripts(resource, action_file, '') self.transport_sync.copy(resource, action_file, action_file_name) - sync_results = self.transport_sync.sync_all() - self.verify_sync_results(sync_results) + self.transport_sync.sync_all() cmd_args = ['puppet', 'apply', '-vd', action_file_name, diff --git a/solar/core/handlers/shell.py b/solar/core/handlers/shell.py index d2c5b023..a028d3f0 100644 --- a/solar/core/handlers/shell.py +++ b/solar/core/handlers/shell.py @@ -33,9 +33,7 @@ class Shell(TempFileHandler): self._copy_templates_and_scripts(resource, action_name) self.transport_sync.copy(resource, self.dst, '/tmp') - sync_results = self.transport_sync.sync_all() - # TODO Include file information in result - self.verify_sync_results(sync_results) + self.transport_sync.sync_all() rst = self.transport_run.run( resource, diff --git a/solar/core/transports/base.py b/solar/core/transports/base.py index c867d5fd..1dbca863 100644 --- a/solar/core/transports/base.py +++ b/solar/core/transports/base.py @@ -12,6 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from solar.core.log import log +from solar import errors + class Executor(object): @@ -38,7 +41,13 @@ class Executor(object): def run(self, transport): if self.valid: - return self._executor(transport) + result = self._executor(transport) + if isinstance(result, tuple) and len(result) == 3: + # TODO Include file information in result + rc, out, err = result + log.debug('RC %s OUT %s ERR %s', rc, out, err) + if rc: + raise errors.SolarError(err) class SolarRunResultWrp(object): @@ -131,10 +140,8 @@ class SyncTransport(SolarTransport): self.preprocess(executor) def run_all(self): - rst = [] for executor in self.executors: - rst.append(executor.run(self)) - return rst + executor.run(self) def sync_all(self): """Syncs all @@ -144,9 +151,8 @@ class SyncTransport(SolarTransport): Could be someday changed to parallel thing. """ self.preprocess_all() - rst = self.run_all() + self.run_all() self.executors = [] # clear after all - return rst class RunTransport(SolarTransport): diff --git a/solar/core/transports/bat.py b/solar/core/transports/bat.py index 32c66337..5843ed88 100644 --- a/solar/core/transports/bat.py +++ b/solar/core/transports/bat.py @@ -60,12 +60,8 @@ class OnAll(object): def __get__(self, obj, objtype): def _inner(*args, **kwargs): - results = [] for transport in obj._used_transports: - rst = getattr(transport, self._target)(*args, **kwargs) - if rst: - results.extend(rst) - return results + getattr(transport, self._target)(*args, **kwargs) return _inner