def operation(self, target, origin_path, target_path): self.log("Downloading from {0}:{1} to {2}:{3}...".format(utils.reverse(target), origin_path, target, target_path)) if utils.is_local(target): operations.get(remote_path=origin_path, local_path=target_path) if utils.is_remote(target): operations.put(remote_path=target_path, local_path=origin_path)
def operation(self, target, origin_path, target_path): self.log("Downloading from {0}:{1} to {2}:{3}...".format( utils.reverse(target), origin_path, target, target_path)) if utils.is_local(target): operations.get(remote_path=origin_path, local_path=target_path) if utils.is_remote(target): operations.put(remote_path=target_path, local_path=origin_path)
def operation(self, target, command): """run a wpcli command on local or remote""" # get wp-cli path on target wp = utils.setting('wp-cli', target, 'wp') full_command = "{0} {1}".format(wp, command) if utils.is_local(target): with lcd(utils.setting("path", target)): r = local(full_command, capture=True) if utils.is_remote(target): with cd(utils.setting("path", target)): r = run(full_command) if self.called_via_fab: self.log(r) return r
def operation(self, target, command, capture=True): if utils.is_local(target): return local(command, capture=capture) if utils.is_remote(target): return run(command)