- person_sfa_keys = persons_to_verify_keys[person_id].get('keys', [])
- person_pl_keys = self.driver.shell.GetKeys({'person_id': int(person_id)})
- person_pl_keys_list = [key['key'] for key in person_pl_keys]
-
- keys_to_add = set(person_sfa_keys).difference(person_pl_keys_list)
-
- for key_string in keys_to_add:
- key = {'key': key_string, 'key_type': 'ssh'}
- self.driver.shell.AddPersonKey(int(person_id), key)
+ person_sfa_keys = persons_to_verify_keys[person_id].get('keys', [])
+ person_pl_keys = self.driver.shell.GetKeys(
+ {'person_id': int(person_id)})
+ person_pl_keys_list = [key['key'] for key in person_pl_keys]
+
+ keys_to_add = set(person_sfa_keys).difference(person_pl_keys_list)
+
+ for key_string in keys_to_add:
+ key = {'key': key_string, 'key_type': 'ssh'}
+ self.driver.shell.AddPersonKey(int(person_id), key)
+
+ def verify_slice_tags(self, slice, requested_slice_attributes,
+ options=None, admin=False):
+ """
+ This function deals with slice tags, and supports 3 modes described
+ in the 'pltags' option that can be either
+ (*) 'ignore' (default) - do nothing
+ (*) 'append' - only add incoming tags, that do not match an existing tag
+ (*) 'sync' - tries to do the plain wholesale thing,
+ i.e. to leave the db in sync with incoming tags
+ """
+ if options is None:
+ options = {}
+
+ # lookup 'pltags' in options to find out which mode is requested here
+ pltags = options.get('pltags', 'ignore')
+ # make sure the default is 'ignore'
+ if pltags not in ('ignore', 'append', 'sync'):
+ pltags = 'ignore'
+
+ if pltags == 'ignore':
+ logger.info(
+ 'verify_slice_tags in ignore mode - leaving slice tags as-is')
+ return