Skip to content

Instantly share code, notes, and snippets.

@exit99
Last active January 31, 2018 21:05
Show Gist options
  • Save exit99/20e32718c0f111cc9e04e62c436c0966 to your computer and use it in GitHub Desktop.
Save exit99/20e32718c0f111cc9e04e62c436c0966 to your computer and use it in GitHub Desktop.
Provisioning by option instead of location
# Current logic for reserving a device by location:
device = hapi.devices.get(server.device_id).json()
device_location = device.get('location')
if location == device_location:
target = server
# The new logic for reserving by option tags, then defaulting to location.
if has_sps_location_tag:
device = hapi.devices.get(server.device_id).json()
tag = device.option.tag
device_location = device.get('location')
if device_location == tag:
target = server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment