def main():
    if mounted(device_name):
        print('Preparation.')     
        print('device_dismount(', device_name, sep='', end=')\n')
        device_dismount(device_name)
        time.sleep(1)
        print()
        
    print('Verify absence of unreachable device.')     
    in_inventory = device_name in inventory()
    in_mounted = device_name in inventory_mounted()
    print(device_name + ' in inventory', in_inventory, sep=': ')
    print(device_name + ' is mounted', in_mounted, sep=': ')
    assert not in_inventory
    assert not in_mounted
    del in_inventory, in_mounted

    print()
    
    print('Discover effect of mounting unreachable device.')     
    print('device_mount(' + device_name, device_address, device_port, sep=', ', end=')\n')
    device_mount(device_name, device_address, device_port, device_username, device_password)
    time.sleep(1)
    in_connected = device_name in inventory_connected()
    in_mounted = device_name in inventory_mounted()
    print(device_name + ' is connected', in_connected, sep=': ')
    print(device_name + ' is mounted', in_mounted, sep=': ')
    assert not in_connected
    assert in_mounted
Ejemplo n.º 2
0
def inventory_purge():
    """
    Dismount any mounted network device that is unconnected.
    """
    device_names = set(inventory_mounted()) - set(inventory_connected())
    for device in device_names:
        device_dismount(device)
Ejemplo n.º 3
0
def inventory_purge():
    """
    Dismount any mounted network device that is unconnected.
    """
    device_names = set(inventory_mounted()) - set(inventory_connected())
    for device in device_names:
        device_dismount(device)
def main():
    if mounted(device_name):
        print('Preparation.')
        print('device_dismount(', device_name, sep='', end=')\n')
        device_dismount(device_name)
        time.sleep(1)
        print()

    print('Verify absence of unreachable device.')
    in_inventory = device_name in inventory()
    in_mounted = device_name in inventory_mounted()
    print(device_name + ' in inventory', in_inventory, sep=': ')
    print(device_name + ' is mounted', in_mounted, sep=': ')
    assert not in_inventory
    assert not in_mounted
    del in_inventory, in_mounted

    print()

    print('Discover effect of mounting unreachable device.')
    print('device_mount(' + device_name,
          device_address,
          device_port,
          sep=', ',
          end=')\n')
    device_mount(device_name, device_address, device_port, device_username,
                 device_password)
    time.sleep(1)
    in_connected = device_name in inventory_connected()
    in_mounted = device_name in inventory_mounted()
    print(device_name + ' is connected', in_connected, sep=': ')
    print(device_name + ' is mounted', in_mounted, sep=': ')
    assert not in_connected
    assert in_mounted
 def setUp(self):
     mounted_list = inventory_mounted()
     if mounted_list:
         for device_name in mounted_list:
             device_dismount(device_name)
             self.assertFalse(mounted(device_name),
                              'Expected dismount: ' + device_name)
 def test_device_dismount(self):
     """
     Apply function device_dismount to every device that is mounted.
     """
     mounted_list = inventory_mounted()
     self.assertTrue(mounted_list, 'One or more devices must be mounted.')
     for device_name in mounted_list:
         device_dismount(device_name)
         self.assertFalse(mounted(device_name), 'Expected not mounted: ' + device_name)
def main():
    print(plain(doc(device_dismount)))
    mounted_list = inventory_mounted()
    if not mounted_list:
        print("There are no mounted devices to dismount.")
    else:
        for device_name in mounted_list:
            print("device_dismount(" + device_name, end=")\n")
            device_dismount(device_name)
def main():
    print(plain(doc(device_dismount)))
    mounted_list = inventory_mounted()
    if not mounted_list:
        print('There are no mounted devices to dismount.')
    else:
        for device_name in mounted_list:
            print('device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)
Ejemplo n.º 9
0
 def test_device_dismount(self):
     """
     Apply function device_dismount to every device that is mounted.
     """
     mounted_list = inventory_mounted()
     self.assertTrue(mounted_list, 'One or more devices must be mounted.')
     for device_name in mounted_list:
         device_dismount(device_name)
         self.assertFalse(mounted(device_name),
                          'Expected not mounted: ' + device_name)
Ejemplo n.º 10
0
 def setUp(self):
     mounted_list = inventory_mounted()
     for device_name in mounted_list:
         print('setup: device_dismount(' + device_name, end=')\n')
         device_dismount(device_name)
     
     if mounted_list:
         print('Sleep to allow Controller to update...')
         time.sleep(2)
         self.assertFalse(inventory_mounted(), 'Dismount required: ' + str(inventory_mounted()))
    def test_dismount_device(self):
        mounted_list = inventory_mounted()
        self.assertTrue(mounted_list, 'One or more devices must be mounted.')
        for device_name in mounted_list:
            print('test: device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)

        print('Sleep to allow Controller to update...')
        time.sleep(2)
        for device_name in mounted_list:
            self.assertFalse(mounted(device_name), 'Mounted: ' + device_name)
Ejemplo n.º 12
0
    def setUp(self):
        mounted_list = inventory_mounted()
        for device_name in mounted_list:
            print('setup: device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)

        if mounted_list:
            print('Sleep to allow Controller to update...')
            time.sleep(2)
            self.assertFalse(inventory_mounted(),
                             'Dismount required: ' + str(inventory_mounted()))
    def test_dismount_device(self):
        mounted_list = inventory_mounted()
        self.assertTrue(mounted_list, 'One or more devices must be mounted.')
        for device_name in mounted_list:
            print('test: device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)

        print('Sleep to allow Controller to update...')
        time.sleep(2)
        for device_name in mounted_list:
            self.assertFalse(mounted(device_name), 'Mounted: ' + device_name)
def main():
    print(plain(doc(device_dismount)))
    assert not mounted(device_name)
    try:
        print('device_dismount(' + device_name, end=')\n')
        device_dismount(device_name)
        exception = False
        print('no exception')
    except Exception:
        exception = True
    finally:
        print('exception:', exception)
        assert not mounted(device_name)
def main():
    print(plain(doc(device_dismount)))
    assert not mounted(device_name)
    try:
        print('device_dismount(' + device_name, end=')\n')
        device_dismount(device_name)
        exception = False
        print('no exception')
    except Exception:
        exception = True
    finally:
        print('exception:', exception)
        assert not mounted(device_name)
def main():
    mounted_list = inventory_mounted()
    if not mounted_list:
        print('There are no mounted devices to dismount.')
    else:
        for device_name in mounted_list:
            print('device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)
        mounted_list = set(mounted_list)
        sleep_total = 0
        remaining_connected = mounted_list & set(inventory_connected())
        while remaining_connected:
            if sleep_total > sleep_interval * 100:
                print('Time out after %s seconds', sleep_total)
                return 2
            print('Disconnecting', *remaining_connected)
            sleep(sleep_interval)
            sleep_total += sleep_interval
            remaining_connected = mounted_list & set(inventory_connected())
            continue
        print('Dismounted %s device(s), slept for %s seconds' % (len(mounted_list), sleep_total))
        return EX_OK
    return EX_TEMPFAIL
def main():
    mounted_list = inventory_mounted()
    if not mounted_list:
        print('There are no mounted devices to dismount.')
    else:
        for device_name in mounted_list:
            print('device_dismount(' + device_name, end=')\n')
            device_dismount(device_name)
        mounted_list = set(mounted_list)
        sleep_total = 0
        remaining_connected = mounted_list & set(inventory_connected())
        while remaining_connected:
            if sleep_total > sleep_interval * 100:
                print('Time out after %s seconds', sleep_total)
                return 2
            print('Disconnecting', *remaining_connected)
            sleep(sleep_interval)
            sleep_total += sleep_interval
            remaining_connected = mounted_list & set(inventory_connected())
            continue
        print('Dismounted %s device(s), slept for %s seconds' %
              (len(mounted_list), sleep_total))
        return EX_OK
    return EX_TEMPFAIL
def demonstrate(device_name):
    print('device_dismount(' + device_name, end=')\n')
    device_dismount(device_name)
Ejemplo n.º 19
0
 def setUp(self):
     mounted_list = inventory_mounted()
     if mounted_list:
         for device_name in mounted_list:
             device_dismount(device_name)
             self.assertFalse(mounted(device_name), "Expected dismount: " + device_name)
def demonstrate(device_name):
    print('device_dismount(' + device_name, end=')\n')
    device_dismount(device_name)