
from __future__ import print_function

from .._errors import StratisCliValueUnimplementedError

def create_pool(dbus_thing, namespace):
    """
    Create a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    if namespace.redundancy != 'none':
        raise StratisCliValueUnimplementedError(
           namespace.redundancy,
           "namespace.redundancy"
        )

    (_, rc, message) = dbus_thing.CreatePool(
       namespace.name,
       namespace.device,
       len(namespace.device)
    )

    return (rc, message)

def list_pools(dbus_thing, namespace):
    """
    List all stratis pools.

    :param Interface dbus_thing: the interface to the stratis manager
    """
    # pylint: disable=unused-argument
    (result, rc, message) = dbus_thing.ListPools()
    if rc != 0:
        return (rc, message)

    for item in result:
        print(item)
    return (rc, message)

def destroy_pool(dbus_thing, namespace):
    """
    Destroy a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    (_, rc, message) = dbus_thing.DestroyPool(
       namespace.name
    )

    return (rc, message)


from __future__ import print_function

from .._errors import StratisCliValueUnimplementedError

def create_pool(dbus_thing, namespace):
    """
    Create a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    if namespace.redundancy != 'none':
        raise StratisCliValueUnimplementedError(
           namespace.redundancy,
           "namespace.redundancy"
        )

    (result, rc, message) = dbus_thing.CreatePool(
       namespace.name,
       namespace.device,
       len(namespace.device)
    )

    if rc == 0:
        print("New pool with object path: %s" % result)

    return (rc, message)

def list_pools(dbus_thing, namespace):
    """
    List all stratis pools.

    :param Interface dbus_thing: the interface to the stratis manager
    """
    # pylint: disable=unused-argument
    (result, rc, message) = dbus_thing.ListPools()
    if rc != 0:
        return (rc, message)

    for item in result:
        print(item)
    return (rc, message)

def destroy_pool(dbus_thing, namespace):
    """
    Destroy a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    (result, rc, message) = dbus_thing.DestroyPool(
       namespace.name
    )

    if rc == 0:
        print("Deleted pool with object path: %s" % result)

    return (rc, message)

Add some extra output for create and destroy.
Add some extra output for create and destroy.

Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>

  
  from __future__ import print_function
  
  from .._errors import StratisCliValueUnimplementedError
  
  def create_pool(dbus_thing, namespace):
      """
      Create a stratis pool.
      """
      if namespace.force:
          raise StratisCliValueUnimplementedError(
             namespace.force,
             "namespace.force"
          )
  
      if namespace.redundancy != 'none':
          raise StratisCliValueUnimplementedError(
             namespace.redundancy,
             "namespace.redundancy"
          )
  
-     (_, rc, message) = dbus_thing.CreatePool(
+     (result, rc, message) = dbus_thing.CreatePool(
         namespace.name,
         namespace.device,
         len(namespace.device)
      )
+ 
+     if rc == 0:
+         print("New pool with object path: %s" % result)
  
      return (rc, message)
  
  def list_pools(dbus_thing, namespace):
      """
      List all stratis pools.
  
      :param Interface dbus_thing: the interface to the stratis manager
      """
      # pylint: disable=unused-argument
      (result, rc, message) = dbus_thing.ListPools()
      if rc != 0:
          return (rc, message)
  
      for item in result:
          print(item)
      return (rc, message)
  
  def destroy_pool(dbus_thing, namespace):
      """
      Destroy a stratis pool.
      """
      if namespace.force:
          raise StratisCliValueUnimplementedError(
             namespace.force,
             "namespace.force"
          )
  
-     (_, rc, message) = dbus_thing.DestroyPool(
+     (result, rc, message) = dbus_thing.DestroyPool(
         namespace.name
      )
  
+     if rc == 0:
+         print("Deleted pool with object path: %s" % result)
+ 
      return (rc, message)
  
Add some extra output for create and destroy.
## Code Before:

from __future__ import print_function

from .._errors import StratisCliValueUnimplementedError

def create_pool(dbus_thing, namespace):
    """
    Create a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    if namespace.redundancy != 'none':
        raise StratisCliValueUnimplementedError(
           namespace.redundancy,
           "namespace.redundancy"
        )

    (_, rc, message) = dbus_thing.CreatePool(
       namespace.name,
       namespace.device,
       len(namespace.device)
    )

    return (rc, message)

def list_pools(dbus_thing, namespace):
    """
    List all stratis pools.

    :param Interface dbus_thing: the interface to the stratis manager
    """
    # pylint: disable=unused-argument
    (result, rc, message) = dbus_thing.ListPools()
    if rc != 0:
        return (rc, message)

    for item in result:
        print(item)
    return (rc, message)

def destroy_pool(dbus_thing, namespace):
    """
    Destroy a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    (_, rc, message) = dbus_thing.DestroyPool(
       namespace.name
    )

    return (rc, message)

## Instruction:
Add some extra output for create and destroy.
## Code After:

from __future__ import print_function

from .._errors import StratisCliValueUnimplementedError

def create_pool(dbus_thing, namespace):
    """
    Create a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    if namespace.redundancy != 'none':
        raise StratisCliValueUnimplementedError(
           namespace.redundancy,
           "namespace.redundancy"
        )

    (result, rc, message) = dbus_thing.CreatePool(
       namespace.name,
       namespace.device,
       len(namespace.device)
    )

    if rc == 0:
        print("New pool with object path: %s" % result)

    return (rc, message)

def list_pools(dbus_thing, namespace):
    """
    List all stratis pools.

    :param Interface dbus_thing: the interface to the stratis manager
    """
    # pylint: disable=unused-argument
    (result, rc, message) = dbus_thing.ListPools()
    if rc != 0:
        return (rc, message)

    for item in result:
        print(item)
    return (rc, message)

def destroy_pool(dbus_thing, namespace):
    """
    Destroy a stratis pool.
    """
    if namespace.force:
        raise StratisCliValueUnimplementedError(
           namespace.force,
           "namespace.force"
        )

    (result, rc, message) = dbus_thing.DestroyPool(
       namespace.name
    )

    if rc == 0:
        print("Deleted pool with object path: %s" % result)

    return (rc, message)
