add datacenter location awareness with pseudo-driver (cmd and file) #4
No reviewers
Labels
No labels
help wanted
need testing
status: accepted
status: discussing
type: bug
type: documentation
type: duplicate
type: enhancement
type:hardware
type: invalid
type: major feature
type: minor feature
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: DGNum/netbox-agent#4
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/datacenter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR is fixes issue #1 by letting the users choose how they want to create datacenter awareness
Might cause issue with existing data in netbox if the name isn't in uppercase ?
I think we should use whatever value is returned by the driver without modification.
@ -0,0 +13,4 @@
DATACENTER_LOCATION_DRIVER_FILE = config.get('datacenter_location').get('driver_file')
DATACENTER_LOCATION = config.get('datacenter_location').get('driver')
DATACENTER_LOCATION_REGEX = config.get('datacenter_location').get('regex')
Probably need some sanity check as the drivers (for now) require the regex to have a
datacenter
named group.I think there is 3 solutions :
datacenter
named group (not a big fan)@ -0,0 +43,4 @@
raise Exception(
"Your driver {} doesn't have a get() function, please fix it".format(self.driver)
)
return getattr(self.driver, 'get')(self.driver_value, DATACENTER_LOCATION_REGEX)
We should properly check if the module has a
get
method to output a proper error message if a custom driver is not compliant instead of an ugly stacktrace.@ -0,0 +43,4 @@
raise Exception(
"Your driver {} doesn't have a get() function, please fix it".format(self.driver)
)
return getattr(self.driver, 'get')(self.driver_value, DATACENTER_LOCATION_REGEX)
Fixed in last commit
fixed in
d90eac3fe6
@ -0,0 +13,4 @@
DATACENTER_LOCATION_DRIVER_FILE = config.get('datacenter_location').get('driver_file')
DATACENTER_LOCATION = config.get('datacenter_location').get('driver')
DATACENTER_LOCATION_REGEX = config.get('datacenter_location').get('regex')
fixed in
9f0db28
for the sanity check, will address that in a PR around configuration file