Skip to content

Commit

Permalink
fix: Quick fix whitelabel script error (openedx#546)
Browse files Browse the repository at this point in the history
* fix: fixed script execution after commenting fullstory

* chore: added missed quote

* chore: edit regex since dev team could be set as empty in project file

---------

Co-authored-by: Anton Yarmolenko <[email protected]>
  • Loading branch information
rnr and rnr authored Dec 5, 2024
1 parent 55f601c commit b3e6184
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config_script/whitelabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def set_global_parameter(self, parameter):
# define regex rule and replacement string for every possible parameter
if parameter == "dev_team":
parameter_string = 'DEVELOPMENT_TEAM = '+parameter_value+';'
parameter_regex = 'DEVELOPMENT_TEAM = .{10};'
parameter_regex = 'DEVELOPMENT_TEAM = (.{10}|\"\");'
elif parameter == "marketing_version":
parameter_string = 'MARKETING_VERSION = '+parameter_value+';'
parameter_regex = 'MARKETING_VERSION = .*;'
Expand Down Expand Up @@ -419,7 +419,7 @@ def set_team_for_target(self, target):
config_file_string_out = config_file_string
# string and regex for dev team
parameter_string = 'DEVELOPMENT_TEAM = '+dev_team+';'
parameter_regex = 'DEVELOPMENT_TEAM = .{10};'
parameter_regex = 'DEVELOPMENT_TEAM = (.{10}|\"\");'
# replace all regex findings with new parameters string
config_file_string_out = re.sub(parameter_regex, parameter_string, config_file_string)
# if something was changed
Expand All @@ -430,7 +430,7 @@ def set_team_for_target(self, target):
logging.debug("DEVELOPMENT_TEAM for '"+target+"' target was set successfuly")
# if nothing was found
elif re.search(parameter_regex, config_file_string) is None:
logging.error("Check regex please. Nothing was found for 'DEVELOPMENT_TEAM' in '"+target+" target project file")
logging.error("Check regex please. Nothing was found for 'DEVELOPMENT_TEAM' in '"+target+"' target project file")
else:
logging.debug("Looks like DEVELOPMENT_TEAM for '"+target+"' target is set already")

Expand Down Expand Up @@ -569,6 +569,7 @@ def set_flags_from_mobile_config(self):
if config_folder:
# example of usage
# project_file_string = self.replace_fullstory_flag(project_file_string, config_directory, name, config_folder, errors_texts)
pass
else:
logging.error("Config folder for '"+config['env_config']+"' is not defined in config_settings.yaml->config_mapping")
else:
Expand Down

0 comments on commit b3e6184

Please sign in to comment.