mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	upgrade: Move puppet class renames earlier.
These do not need to happen during the critical period when the server is stopped.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							a201e3b25b
						
					
				
				
					commit
					2f7068ffbb
				
			@@ -234,6 +234,31 @@ subprocess.check_call(
 | 
				
			|||||||
    [os.path.join(deploy_path, "scripts", "setup", "generate_secrets.py"), "--production"]
 | 
					    [os.path.join(deploy_path, "scripts", "setup", "generate_secrets.py"), "--production"]
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Adjust Puppet class names for the manifest renames in the 4.0 release
 | 
				
			||||||
 | 
					class_renames = {
 | 
				
			||||||
 | 
					    "zulip::app_frontend": "zulip::profile::app_frontend",
 | 
				
			||||||
 | 
					    "zulip::dockervoyager": "zulip::profile::docker",
 | 
				
			||||||
 | 
					    "zulip::memcached": "zulip::profile::memcached",
 | 
				
			||||||
 | 
					    "zulip::postgres_appdb_tuned": "zulip::profile::postgresql",
 | 
				
			||||||
 | 
					    "zulip::postgres_backups": "zulip::postgresql_backups",
 | 
				
			||||||
 | 
					    "zulip::rabbit": "zulip::profile::rabbitmq",
 | 
				
			||||||
 | 
					    "zulip::voyager": "zulip::profile::standalone",
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					classes = re.split(r"\s*,\s*", get_config(config_file, "machine", "puppet_classes"))
 | 
				
			||||||
 | 
					new_classes = [class_renames.get(c, c) for c in classes if c != "zulip::base"]
 | 
				
			||||||
 | 
					if classes != new_classes:
 | 
				
			||||||
 | 
					    logging.info("Adjusting Puppet classes for renames...")
 | 
				
			||||||
 | 
					    subprocess.check_call(
 | 
				
			||||||
 | 
					        [
 | 
				
			||||||
 | 
					            "crudini",
 | 
				
			||||||
 | 
					            "--set",
 | 
				
			||||||
 | 
					            "/etc/zulip/zulip.conf",
 | 
				
			||||||
 | 
					            "machine",
 | 
				
			||||||
 | 
					            "puppet_classes",
 | 
				
			||||||
 | 
					            ", ".join(new_classes),
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Unpleasant migration: Remove any legacy deployed copies of
 | 
					# Unpleasant migration: Remove any legacy deployed copies of
 | 
				
			||||||
# images-google-64 from before we renamed that emojiset to
 | 
					# images-google-64 from before we renamed that emojiset to
 | 
				
			||||||
# "googleblob":
 | 
					# "googleblob":
 | 
				
			||||||
@@ -330,32 +355,6 @@ if cookie_size is not None and cookie_size == 20:
 | 
				
			|||||||
    logging.info("Generating a secure erlang cookie...")
 | 
					    logging.info("Generating a secure erlang cookie...")
 | 
				
			||||||
    subprocess.check_call(["./scripts/setup/generate-rabbitmq-cookie"])
 | 
					    subprocess.check_call(["./scripts/setup/generate-rabbitmq-cookie"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Adjust Puppet class names for the manifest renames in the 4.0 release
 | 
					 | 
				
			||||||
class_renames = {
 | 
					 | 
				
			||||||
    "zulip::app_frontend": "zulip::profile::app_frontend",
 | 
					 | 
				
			||||||
    "zulip::dockervoyager": "zulip::profile::docker",
 | 
					 | 
				
			||||||
    "zulip::memcached": "zulip::profile::memcached",
 | 
					 | 
				
			||||||
    "zulip::postgres_appdb_tuned": "zulip::profile::postgresql",
 | 
					 | 
				
			||||||
    "zulip::postgres_backups": "zulip::postgresql_backups",
 | 
					 | 
				
			||||||
    "zulip::rabbit": "zulip::profile::rabbitmq",
 | 
					 | 
				
			||||||
    "zulip::voyager": "zulip::profile::standalone",
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
classes = re.split(r"\s*,\s*", get_config(config_file, "machine", "puppet_classes"))
 | 
					 | 
				
			||||||
new_classes = [class_renames.get(c, c) for c in classes if c != "zulip::base"]
 | 
					 | 
				
			||||||
if classes != new_classes:
 | 
					 | 
				
			||||||
    logging.info("Adjusting Puppet classes for renames...")
 | 
					 | 
				
			||||||
    subprocess.check_call(
 | 
					 | 
				
			||||||
        [
 | 
					 | 
				
			||||||
            "crudini",
 | 
					 | 
				
			||||||
            "--set",
 | 
					 | 
				
			||||||
            "/etc/zulip/zulip.conf",
 | 
					 | 
				
			||||||
            "machine",
 | 
					 | 
				
			||||||
            "puppet_classes",
 | 
					 | 
				
			||||||
            ", ".join(new_classes),
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if not args.skip_puppet:
 | 
					if not args.skip_puppet:
 | 
				
			||||||
    # Puppet may adjust random services; to minimize risk of issues
 | 
					    # Puppet may adjust random services; to minimize risk of issues
 | 
				
			||||||
    # due to inconsistent state, we shut down the server first.
 | 
					    # due to inconsistent state, we shut down the server first.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user