Title: [258141] trunk/Tools
Revision
258141
Author
jbed...@apple.com
Date
2020-03-09 08:11:58 -0700 (Mon, 09 Mar 2020)

Log Message

resultsdbpy: Add tool to manage resultsdbpy container
https://bugs.webkit.org/show_bug.cgi?id=208743

Rubber-stamped by Aakash Jain.

Add tool to start, stop and restart the resultsdbpy Docker container.

* resultsdbpy/resultsdbpy/container: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (258140 => 258141)


--- trunk/Tools/ChangeLog	2020-03-09 15:10:01 UTC (rev 258140)
+++ trunk/Tools/ChangeLog	2020-03-09 15:11:58 UTC (rev 258141)
@@ -1,3 +1,14 @@
+2020-03-09  Jonathan Bedard  <jbed...@apple.com>
+
+        resultsdbpy: Add tool to manage resultsdbpy container
+        https://bugs.webkit.org/show_bug.cgi?id=208743
+
+        Rubber-stamped by Aakash Jain.
+
+        Add tool to start, stop and restart the resultsdbpy Docker container.
+
+        * resultsdbpy/resultsdbpy/container: Added.
+
 2020-03-09  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] Surrounding text for input methods should not be limited to the current paragraph

Added: trunk/Tools/resultsdbpy/resultsdbpy/container (0 => 258141)


--- trunk/Tools/resultsdbpy/resultsdbpy/container	                        (rev 0)
+++ trunk/Tools/resultsdbpy/resultsdbpy/container	2020-03-09 15:11:58 UTC (rev 258141)
@@ -0,0 +1,73 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import argparse
+import os
+import sys
+sys.dont_write_bytecode = True
+
+from model.docker import Docker
+
+
+def start():
+    Docker.start()
+    Docker.start_project(Docker.DEFAULT_PROJECT)
+    return 0
+
+
+def stop():
+    if not Docker.is_running():
+        print('Docker is not running')
+        return 1
+    Docker.stop_project(Docker.DEFAULT_PROJECT)
+    Docker.stop()
+    return 0
+
+
+def restart():
+    if not Docker.is_running():
+        Docker.start()
+    Docker.stop_project(Docker.DEFAULT_PROJECT)
+    Docker.start_project(Docker.DEFAULT_PROJECT)
+    return 0
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Manage resultsdbpy container instance inside Docker')
+    subparsers = parser.add_subparsers(help='sub-command help')
+
+    start_parser = subparsers.add_parser('start', help='Start the container inside Docker')
+    start_parser.set_defaults(function=start)
+
+    start_parser = subparsers.add_parser('stop', help='Stop the container inside Docker')
+    start_parser.set_defaults(function=stop)
+
+    start_parser = subparsers.add_parser('restart', help='Restart the container inside Docker')
+    start_parser.set_defaults(function=restart)
+
+    return getattr(parser.parse_args(), 'function', lambda: parser.print_help())()
+
+
+if __name__ == '__main__':
+    sys.exit(main())
Property changes on: trunk/Tools/resultsdbpy/resultsdbpy/container
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to