def run(): if not workspace().is_configured(): raise ActionException("Project was not already set up") infrastructure().clear() if environment().clear_volumes: infrastructure().clear_volumes()
def print_howto(): print("Connect to WP via:") print("- http://{}/".format(infrastructure().get_wordpress_container_ip())) print("- http://{}/ (you need first to run 'register_host')".format( workspace().config().project_name)) print("") print( "Note: If it is the first time you start the project, you might have to wait a few minutes before WP is actually available." )
def run(): infrastructure().stop()
def run(): infrastructure().start() print_howto()
def remove_components(self, component_type): if os.path.isdir(component_type): for dir_item in os.listdir('{}'.format(component_type)): self.docker_exec(['exec', '{}'.format(infrastructure().get_wordpress_container().id), 'rm', '-rf', '/var/www/html/wp-content/{}/{}'.format(component_type, dir_item)])
def exec_on_container(self, command_line): full_command_line = ['exec', '{}'.format(infrastructure().get_wordpress_container().id)] full_command_line.extend(command_line) self.docker_exec(full_command_line)
def copy_from_container(self, container_path, local_path): self.docker_exec(['cp', '{}:{}'.format(infrastructure().get_wordpress_container().id, container_path), local_path])
def copy_to_container(self, local_path, container_path, owner = None): self.docker_exec(['cp', local_path, '{}:{}'.format(infrastructure().get_wordpress_container().id, container_path)]) if owner: self.exec_on_container(['chown', '-R', '{}:{}'.format(owner, owner), container_path])
def run(self): container = infrastructure().get_wordpress_container() if not container: raise ActionException("This WP project must first be started") self.run_with_container()
def _run_after_backup(self): ip_address = infrastructure().get_wordpress_container_ip() self.deregister() self.register(ip_address)