@@ -2032,7 +2032,8 @@ def get_sync_policy_group(self, group_id: str, bucket_name: str = '',
20322032 except SubprocessError as error :
20332033 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
20342034
2035- def create_sync_policy_group (self , group_id : str , status : str , bucket_name : str = '' ):
2035+ def create_sync_policy_group (self , group_id : str , status : str , bucket_name : str = '' ,
2036+ update_period = False ):
20362037 rgw_sync_policy_cmd = ['sync' , 'group' , 'create' , '--group-id' , group_id ,
20372038 '--status' , SyncStatus [status ].value ]
20382039 if bucket_name :
@@ -2044,8 +2045,11 @@ def create_sync_policy_group(self, group_id: str, status: str, bucket_name: str
20442045 http_status_code = 500 , component = 'rgw' )
20452046 except SubprocessError as error :
20462047 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2048+ if not bucket_name and update_period :
2049+ self .update_period ()
20472050
2048- def update_sync_policy_group (self , group_id : str , status : str , bucket_name : str = '' ):
2051+ def update_sync_policy_group (self , group_id : str , status : str , bucket_name : str = '' ,
2052+ update_period = False ):
20492053 rgw_sync_policy_cmd = ['sync' , 'group' , 'modify' , '--group-id' , group_id ,
20502054 '--status' , SyncStatus [status ].value ]
20512055 if bucket_name :
@@ -2057,8 +2061,10 @@ def update_sync_policy_group(self, group_id: str, status: str, bucket_name: str
20572061 http_status_code = 500 , component = 'rgw' )
20582062 except SubprocessError as error :
20592063 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2064+ if not bucket_name and update_period :
2065+ self .update_period ()
20602066
2061- def remove_sync_policy_group (self , group_id : str , bucket_name = '' ):
2067+ def remove_sync_policy_group (self , group_id : str , bucket_name = '' , update_period = False ):
20622068 rgw_sync_policy_cmd = ['sync' , 'group' , 'remove' , '--group-id' , group_id ]
20632069 if bucket_name :
20642070 rgw_sync_policy_cmd += ['--bucket' , bucket_name ]
@@ -2069,11 +2075,14 @@ def remove_sync_policy_group(self, group_id: str, bucket_name=''):
20692075 http_status_code = 500 , component = 'rgw' )
20702076 except SubprocessError as error :
20712077 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2078+ if not bucket_name and update_period :
2079+ self .update_period ()
20722080
20732081 def create_sync_flow (self , group_id : str , flow_id : str , flow_type : str ,
20742082 zones : Optional [Dict [str , List ]] = None , bucket_name : str = '' ,
20752083 source_zone : Optional [str ] = None ,
2076- destination_zone : Optional [str ] = None ):
2084+ destination_zone : Optional [str ] = None ,
2085+ update_period = False ):
20772086 rgw_sync_policy_cmd = ['sync' , 'group' , 'flow' , 'create' , '--group-id' , group_id ,
20782087 '--flow-id' , flow_id , '--flow-type' , SyncFlowTypes [flow_type ].value ]
20792088
@@ -2114,10 +2123,13 @@ def create_sync_flow(self, group_id: str, flow_id: str, flow_type: str,
21142123 if len (zones ['removed' ]) > 0 :
21152124 self .remove_sync_flow (group_id , flow_id , flow_type , source_zone ,
21162125 destination_zone , zones ['removed' ], bucket_name )
2126+ if not bucket_name and update_period :
2127+ self .update_period ()
21172128
21182129 def remove_sync_flow (self , group_id : str , flow_id : str , flow_type : str ,
21192130 source_zone = '' , destination_zone = '' ,
2120- zones : Optional [List [str ]] = None , bucket_name : str = '' ):
2131+ zones : Optional [List [str ]] = None , bucket_name : str = '' ,
2132+ update_period = False ):
21212133 rgw_sync_policy_cmd = ['sync' , 'group' , 'flow' , 'remove' , '--group-id' , group_id ,
21222134 '--flow-id' , flow_id , '--flow-type' , SyncFlowTypes [flow_type ].value ]
21232135
@@ -2138,13 +2150,16 @@ def remove_sync_flow(self, group_id: str, flow_id: str, flow_type: str,
21382150 http_status_code = 500 , component = 'rgw' )
21392151 except SubprocessError as error :
21402152 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2153+ if not bucket_name and update_period :
2154+ self .update_period ()
21412155
21422156 def create_sync_pipe (self , group_id : str , pipe_id : str ,
21432157 source_zones : Dict [str , Any ],
21442158 destination_zones : Dict [str , Any ],
21452159 source_bucket : str = '' ,
21462160 destination_bucket : str = '' ,
2147- bucket_name : str = '' ):
2161+ bucket_name : str = '' ,
2162+ update_period = False ):
21482163
21492164 if source_zones ['added' ] or destination_zones ['added' ]:
21502165 rgw_sync_policy_cmd = ['sync' , 'group' , 'pipe' , 'create' ,
@@ -2173,6 +2188,8 @@ def create_sync_pipe(self, group_id: str, pipe_id: str,
21732188 http_status_code = 500 , component = 'rgw' )
21742189 except SubprocessError as error :
21752190 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2191+ if not bucket_name and update_period :
2192+ self .update_period ()
21762193
21772194 if source_zones ['removed' ] or destination_zones ['removed' ]:
21782195 self .remove_sync_pipe (group_id , pipe_id , source_zones ['removed' ],
@@ -2182,7 +2199,8 @@ def create_sync_pipe(self, group_id: str, pipe_id: str,
21822199 def remove_sync_pipe (self , group_id : str , pipe_id : str ,
21832200 source_zones : Optional [List [str ]] = None ,
21842201 destination_zones : Optional [List [str ]] = None ,
2185- destination_bucket : str = '' , bucket_name : str = '' ):
2202+ destination_bucket : str = '' , bucket_name : str = '' ,
2203+ update_period = False ):
21862204 rgw_sync_policy_cmd = ['sync' , 'group' , 'pipe' , 'remove' ,
21872205 '--group-id' , group_id , '--pipe-id' , pipe_id ]
21882206
@@ -2206,6 +2224,8 @@ def remove_sync_pipe(self, group_id: str, pipe_id: str,
22062224 http_status_code = 500 , component = 'rgw' )
22072225 except SubprocessError as error :
22082226 raise DashboardException (error , http_status_code = 500 , component = 'rgw' )
2227+ if not bucket_name and update_period :
2228+ self .update_period ()
22092229
22102230 def create_dashboard_admin_sync_group (self , zonegroup_name : str = '' ):
22112231
0 commit comments