Skip to content

Commit

Permalink
move config section to top
Browse files Browse the repository at this point in the history
  • Loading branch information
aabouzaid committed Sep 16, 2017
1 parent a1599d1 commit 214ce1a
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions netbox/tests/test_netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,43 @@
# Init.
###############################################################################

# Netbox config file.
netbox_config = '''
netbox:
main:
api_url: 'http://localhost/api/dcim/devices/'
# How servers will be grouped.
# If no group specified here, inventory script will return all servers.
group_by:
# Default section in Netbox.
default:
- device_role
- rack
- platform
# Custom sections (custom_fields) could be used.
#custom:
# - env
# Use Netbox sections as host variables.
hosts_vars:
# Sections related to IPs e.g. "primary_ip" or "primary_ip4".
ip:
ansible_ssh_host: primary_ip
# Any other sections.
general:
rack_name: rack
# Custom sections (custom_fields) could be used as vars too.
#custom:
# env: env
'''

# Mock open Netbox config file.
netbox_config_file = tempfile.NamedTemporaryFile(delete=False, mode='a')
netbox_config_file.write(netbox_config)
netbox_config_file.close()
netbox_config_data = yaml.load(netbox_config)

# Fake Netbox api output.
netbox_api_output = json.loads('''
[
Expand Down Expand Up @@ -172,43 +209,6 @@
}
''')

# Netbox config file.
netbox_config = '''
netbox:
main:
api_url: 'http://localhost/api/dcim/devices/'
# How servers will be grouped.
# If no group specified here, inventory script will return all servers.
group_by:
# Default section in Netbox.
default:
- device_role
- rack
- platform
# Custom sections (custom_fields) could be used.
#custom:
# - env
# Use Netbox sections as host variables.
hosts_vars:
# Sections related to IPs e.g. "primary_ip" or "primary_ip4".
ip:
ansible_ssh_host: primary_ip
# Any other sections.
general:
rack_name: rack
# Custom sections (custom_fields) could be used as vars too.
#custom:
# env: env
'''

# Mock open Netbox config file.
netbox_config_file = tempfile.NamedTemporaryFile(delete=False, mode='a')
netbox_config_file.write(netbox_config)
netbox_config_file.close()
netbox_config_data = yaml.load(netbox_config)

# Common vars.
netbox_api_output_json = json.dumps(netbox_api_output)
fake_host_json = json.dumps(fake_host)
Expand Down

0 comments on commit 214ce1a

Please sign in to comment.