FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Make licensing update optional

Merged Robin Goodall requested to merge optional-licensing into master
3 files
+ 20
13
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -304,7 +304,7 @@ class Comparator(ConfigurationStateConsumer):
'gids_to_update_group_settings': gids_to_update_group_settings,
})
def enforce_limits(self, just_users):
def enforce_limits(self, just_users, licensing):
# --------------------------------------------------------------------------------------------
# Enforce limits on how much data to change in Google.
# --------------------------------------------------------------------------------------------
@@ -319,10 +319,10 @@ class Comparator(ConfigurationStateConsumer):
)
LOG.info('Configuration will modify %.2f%% of users', user_change_percentage)
if self.licensing_config.product_id is not None:
if licensing and self.licensing_config.product_id is not None:
# Calculate percentage change in licence assignments.
licence_change_percentage = 100. * (
len(self.state.licences_to_add) + len(self.state.licences_to_remove)
len(self.state.licences_to_add | self.state.licences_to_remove)
/
max(1, len(self.state.google_licensed_uids))
)
@@ -354,7 +354,7 @@ class Comparator(ConfigurationStateConsumer):
)
raise RuntimeError('Aborting due to large user change percentage')
if self.licensing_config.product_id is not None:
if licensing and self.licensing_config.product_id is not None:
if (
self.limits_config.abort_licence_change_percentage is not None and
licence_change_percentage > self.limits_config.abort_licence_change_percentage
@@ -434,7 +434,7 @@ class Comparator(ConfigurationStateConsumer):
LOG.info('Capped number of users to update to %s', len(self.state.uids_to_update))
# Licences
if self.licensing_config.product_id is not None:
if licensing and self.licensing_config.product_id is not None:
if (self.limits_config.max_add_licence is not None and
len(self.state.licences_to_add) > self.limits_config.max_add_licence):
self.state.licences_to_add = _limit(
Loading