@pytest.fixture()
def node(Ansible, Interface, Command, request):
 ansible_vars = Ansible.get_variables()
 node_type = ansible_vars['group_names'][0]
 docker = ansible_vars.get('docker')
 if ((not request.node.get_marker(node_type)) and (not request.node.get_marker('all'))):
  pytest.skip(('Not a valid test for node type: %s' % node_type))
 if (request.node.get_marker('no_docker') and docker):
  pytest.skip('Not a valid test for containerized deployments or atomic hosts')
 journal_collocation_test = (ansible_vars.get('journal_collocation') or ansible_vars.get('dmcrypt_journal_collocation'))
 if (request.node.get_marker('journal_collocation') and (not journal_collocation_test)):
  pytest.skip('Scenario is not using journal collocation')
 osd_ids = []
 osds = []
 cluster_address = ''
 if (node_type == 'osds'):
  result = Command.check_output('sudo ls /var/lib/ceph/osd/ | grep -oP "\\d+$"')
  osd_ids = result.split('\n')
  cluster_address = Interface('eth2').addresses[0]
  osds = osd_ids
  if docker:
   osds = [device.split('/')[(-1)] for device in ansible_vars['devices']]
 address = Interface('eth1').addresses[0]
 subnet = '.'.join(ansible_vars['public_network'].split('.')[0:(-1)])
 num_mons = len(ansible_vars['groups']['mons'])
 num_devices = len(ansible_vars['devices'])
 num_osd_hosts = len(ansible_vars['groups']['osds'])
 total_osds = (num_devices * num_osd_hosts)
 cluster_name = ansible_vars.get('cluster', 'ceph')
 conf_path = '/etc/ceph/{}.conf'.format(cluster_name)
 data = dict(address=address, subnet=subnet, vars=ansible_vars, osd_ids=osd_ids, num_mons=num_mons, num_devices=num_devices, num_osd_hosts=num_osd_hosts, total_osds=total_osds, cluster_name=cluster_name, conf_path=conf_path, cluster_address=cluster_address, docker=docker, osds=osds)
 return data

@ pytest . fixture ( ) def node ( Ansible , Interface , Command , request ) : ansible_vars = Ansible . get_variables ( ) node_type = ansible_vars [ 'group_names' ] [ 0 ] docker = ansible_vars . get ( 'docker' ) if ( ( not request . node . get_marker ( node_type ) ) and ( not request . node . get_marker ( 'all' ) ) ) : pytest . skip ( ( 'Not a valid test for node type: %s' % node_type ) ) if ( request . node . get_marker ( 'no_docker' ) and docker ) : pytest . skip ( 'Not a valid test for containerized deployments or atomic hosts' ) journal_collocation_test = ( ansible_vars . get ( 'journal_collocation' ) or ansible_vars . get ( 'dmcrypt_journal_collocation' ) ) if ( request . node . get_marker ( 'journal_collocation' ) and ( not journal_collocation_test ) ) : pytest . skip ( 'Scenario is not using journal collocation' ) osd_ids = [ ] osds = [ ] cluster_address = '' if ( node_type == 'osds' ) : result = Command . check_output ( 'sudo ls /var/lib/ceph/osd/ | grep -oP "\\d+$"' ) osd_ids = result . split ( '\n' ) cluster_address = Interface ( 'eth2' ) . addresses [ 0 ] osds = osd_ids if docker : osds = [ device . split ( '/' ) [ ( - 1 ) ] for device in ansible_vars [ 'devices' ] ] address = Interface ( 'eth1' ) . addresses [ 0 ] subnet = '.' . join ( ansible_vars [ 'public_network' ] . split ( '.' ) [ 0 : ( - 1 ) ] ) num_mons = len ( ansible_vars [ 'groups' ] [ 'mons' ] ) num_devices = len ( ansible_vars [ 'devices' ] ) num_osd_hosts = len ( ansible_vars [ 'groups' ] [ 'osds' ] ) total_osds = ( num_devices * num_osd_hosts ) cluster_name = ansible_vars . get ( 'cluster' , 'ceph' ) conf_path = '/etc/ceph/{}.conf' . format ( cluster_name ) data = dict ( address = address , subnet = subnet , vars = ansible_vars , osd_ids = osd_ids , num_mons = num_mons , num_devices = num_devices , num_osd_hosts = num_osd_hosts , total_osds = total_osds , cluster_name = cluster_name , conf_path = conf_path , cluster_address = cluster_address , docker = docker , osds = osds ) return data
returns the computers network name an empty string is returned if the value cannot be determined .