#79 Make --all the default in testcloud instance list
Merged 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

file modified
+1 -8
@@ -62,13 +62,6 @@ 

  $ testcloud instance list

  ```

  

- Note, that the above command will only list the **running** instances.

- To see all instances, use:

- 

- ```

- $ testcloud instance list --all

- ```

- 

  Alternatively, the instances can also be viewed and manipulated using

  the **virt-manager** tool.

  
@@ -80,7 +73,7 @@ 

  1. List all instances to see the correct name of the instance:

  

         ```

-        $ testcloud instance list --all

+        $ testcloud instance list

         ```

  

  2. Start the instance:

file modified
+12 -18
@@ -1,6 +1,6 @@ 

  .. testcloud documentation master file, created by

     sphinx-quickstart on Wed May 20 14:59:21 2015.

-    

+ 

  .. Last updated on Fri Nov 13 13:56:10 2020.

  

  .. This work is licensed under the Creative Commons Attribution 4.0
@@ -11,7 +11,7 @@ 

  Testcloud User's Guide

  ======================

  

- **testcloud** is a simple system which is capable of downloading images designed 

+ **testcloud** is a simple system which is capable of downloading images designed

  for cloud systems and booting them locally with minimial configuration needed.

  **testcloud** is designed to be simple and lean, trading fancy cloud

  system features for ease of use and sanity in development.
@@ -28,7 +28,7 @@ 

      #. Install the testcloud package.

  

          .. code-block:: bash

-         

+ 

              $ sudo dnf install testcloud

  

      #. Add yourself to the testcloud group.
@@ -99,12 +99,6 @@ 

  

              $ testcloud instance list

  

-     #. To list all available instances:

- 

-         .. code-block:: bash

- 

-             $ testcloud instance list --all

- 

      #. To start the instance:

  

          .. code-block:: bash
@@ -171,15 +165,15 @@ 

  

  .. code-block:: python

  

-     USER_DATA = """#cloud-config 

-     users: 

-         - default 

-         - name: root 

-               password: %s 

-               chpasswd: { expire: False } 

-               ssh-authorized-keys: 

-         - <my ssh pub key> 

-     """ 

+     USER_DATA = """#cloud-config

+     users:

+         - default

+         - name: root

+               password: %s

+               chpasswd: { expire: False }

+               ssh-authorized-keys:

+         - <my ssh pub key>

+     """

  

  Getting Help

  ============

file modified
+1 -1
@@ -109,7 +109,7 @@ 

  .PP

  List all available instances:

  .IP

- \fBtestcloud instance list --all\fR

+ \fBtestcloud instance list\fR

  .PP

  Start an existing instance:

  .IP

file modified
+13 -3
@@ -61,13 +61,23 @@ 

      """

      instances = instance.list_instances(args.connection)

  

+     if args.all:

+         log.warning("(DEPRECATED) --all is now the default behavior")

+ 

      print("{!s:<16} {!s:^30}     {!s:<10}".format("Name", "IP", "State"))

      print("-"*60)

      for inst in instances:

-         if args.all or inst['state'] == 'running':

+         # Running first

+         if inst['state'] == 'running':

              print("{!s:<27} {!s:^22}  {!s:<10}".format(inst['name'],

                                                         inst['ip'],

                                                         inst['state']))

+     # And everything else

+     for inst in instances:

+         if inst['state'] != 'running':

+             print("{!s:<27} {!s:^22}  {!s:<10}".format(inst['name'],

+                                                         inst['ip'],

+                                                         inst['state']))

  

      print("")

  
@@ -395,10 +405,10 @@ 

                                            help="<command> help")

  

      # instance list

-     instarg_list = instarg_subp.add_parser("list", help="list instances")

+     instarg_list = instarg_subp.add_parser("list", help="list all instances")

      instarg_list.set_defaults(func=_list_instance)

      instarg_list.add_argument("--all",

-                               help="list all instances, running and stopped",

+                               help="(DEPRECATED) --all is now the default behavior",

                                action="store_true")

  

      # instance start

no initial comment

Pull-Request has been merged by frantisekz

3 years ago