@@ -567,59 +567,6 @@ def server_upgrade_db(config):
567567 sys .exit (1 )
568568
569569
570- def server_upgrade_config (config_path ):
571- import secrets
572- from qcfractal .old_config import OldFractalQCFConfig
573- from qcfractal .config import convert_old_configuration
574-
575- logger = logging .getLogger (__name__ )
576-
577- logger .info (f"Reading configuration data from { config_path } " )
578- with open (config_path , "r" ) as yf :
579- file_data = yaml .safe_load (yf )
580-
581- # Is this really an old config?
582- if "fractal" not in file_data :
583- logger .info (f"Configuration appears to be up-to-date" )
584- return
585-
586- old_qcf_config = OldFractalQCFConfig (** file_data )
587- new_qcf_config = convert_old_configuration (old_qcf_config )
588-
589- # Move the old file out of the way
590- base_backup_path = config_path + ".backup"
591- backup_path = base_backup_path
592-
593- # Find a suitable backup name. If the path exists,
594- # add .1, .2, .3, etc, until it does
595- i = 1
596- while os .path .exists (backup_path ):
597- backup_path = base_backup_path + f".{ i } "
598- i += 1
599-
600- logger .info (f"Moving original configuration to { backup_path } " )
601- shutil .move (config_path , backup_path )
602-
603- # We strip out some stuff from the configuration, including things that were
604- # set to the default
605- new_qcf_config_dict = new_qcf_config .dict (skip_defaults = True )
606- new_qcf_config_dict ["database" ].pop ("base_folder" )
607- new_qcf_config_dict .pop ("base_folder" )
608-
609- # Generate secret keys for the user. They can always change it later
610- new_qcf_config_dict ["api" ]["secret_key" ] = secrets .token_hex (24 )
611- new_qcf_config_dict ["api" ]["jwt_secret_key" ] = secrets .token_hex (24 )
612-
613- logger .info (f"Writing new configuration data to { config_path } " )
614- with open (config_path , "w" ) as yf :
615- yaml .dump (new_qcf_config_dict , yf )
616-
617- logger .info ("*" * 80 )
618- logger .info ("Your configuration file has been upgraded, but will most likely need some fine tuning." )
619- logger .info (f"Please edit { config_path } by hand. See the upgrade documentation for details." )
620- logger .info ("*" * 80 )
621-
622-
623570def server_user (args : argparse .Namespace , config : FractalConfig ):
624571 user_command = args .user_command
625572
@@ -901,8 +848,7 @@ def main():
901848 if args .command == "upgrade-config" :
902849 if args .config is None :
903850 raise RuntimeError ("Configuration file path (--config) is required for upgrading configuration" )
904- server_upgrade_config (args .config )
905- exit (0 )
851+ raise RuntimeError ("Upgrade configuration is not yet supported" )
906852
907853 # Check for the config path on the command line. The command line
908854 # always overrides environment variables
0 commit comments