(self)
Code to initialize the plugin
Code to initialize the plugin
Code to initialize the plugin
def initialize_plugin(self) -> None:
        """
        Code to initialize the plugin
        """
        swift_credentials = {
            "user_domain_name": self.get_config_value(
                "user_domain_name", "OS_USER_DOMAIN_NAME", default="default"
            ),
            "project_domain_name": self.get_config_value(
                "project_domain_name", "OS_PROJECT_DOMAIN_NAME", default="default"
            ),
            "password": self.get_config_value("password", "OS_PASSWORD"),
        }
        os_options: Dict[str, Any] = {}
        user_id = self.get_config_value("username", "OS_USER_ID", "OS_USERNAME")
        project = self.get_config_value(
            "project_name", "OS_PROJECT_NAME", "OS_TENANT_NAME"
        )
        auth_url = self.get_config_value(
            "auth_url", "OS_AUTH_URL", "OS_AUTHENTICATION_URL"
        )
        object_storage_url = self.get_config_value(
            "object_storage_url", "OS_STORAGE_URL"
        )
        region = self.get_config_value("region", "OS_REGION_NAME")
        project_id = self.get_config_value("project_id", "OS_PROJECT_ID")
        if user_id:
            swift_credentials["username"] = user_id
        if project:
            swift_credentials["project_name"] = project
            os_options["project_name"] = project
        if object_storage_url:
            os_options["object_storage_url"] = object_storage_url
        if region:
            os_options["region_name"] = region
        if project_id:
            os_options["PROJECT_ID"] = project_id
        if auth_url:
            swift_credentials["auth_url"] = auth_url
        self.os_options = os_options
        self.auth = keystoneauth1.identity.v3.Password(**swift_credentials)
        self._test_connection()
        SwiftPath.register_backend(self)
        _SwiftAccessor.register_backend(self)
        global _swift_accessor
        _swift_accessor = _SwiftAccessor
def initialize_plugin ( self ) -> None : swift_credentials = { "user_domain_name" : self . get_config_value ( "user_domain_name" , "OS_USER_DOMAIN_NAME" , default = "default" ) , "project_domain_name" : self . get_config_value ( "project_domain_name" , "OS_PROJECT_DOMAIN_NAME" , default = "default" ) , "password" : self . get_config_value ( "password" , "OS_PASSWORD" ) , } os_options : Dict [ str , Any ] = { } user_id = self . get_config_value ( "username" , "OS_USER_ID" , "OS_USERNAME" ) project = self . get_config_value ( "project_name" , "OS_PROJECT_NAME" , "OS_TENANT_NAME" ) auth_url = self . get_config_value ( "auth_url" , "OS_AUTH_URL" , "OS_AUTHENTICATION_URL" ) object_storage_url = self . get_config_value ( "object_storage_url" , "OS_STORAGE_URL" ) region = self . get_config_value ( "region" , "OS_REGION_NAME" ) project_id = self . get_config_value ( "project_id" , "OS_PROJECT_ID" ) if user_id : swift_credentials [ "username" ] = user_id if project : swift_credentials [ "project_name" ] = project os_options [ "project_name" ] = project if object_storage_url : os_options [ "object_storage_url" ] = object_storage_url if region : os_options [ "region_name" ] = region if project_id : os_options [ "PROJECT_ID" ] = project_id if auth_url : swift_credentials [ "auth_url" ] = auth_url self . os_options = os_options self . auth = keystoneauth1 . identity . v3 . Password ( * * swift_credentials ) self . _test_connection ( ) SwiftPath . register_backend ( self ) _SwiftAccessor . register_backend ( self ) global _swift_accessor _swift_accessor = _SwiftAccessor