11"""Snapshot and Restore action classes"""
22import logging
3- from curator .helpers .getters import get_alias_actions , get_frozen_prefix , get_tier_preference
3+ from curator .helpers .getters import get_alias_actions , get_tier_preference , meta_getter
44from curator .helpers .testers import has_lifecycle_name , is_idx_partial , verify_index_list
55from curator .helpers .utils import report_failure
66from curator .exceptions import CuratorException , FailedExecution , SearchableSnapshotException
@@ -76,7 +76,8 @@ def action_generator(self):
7676 :rtype: dict
7777 """
7878 for idx in self .index_list .indices :
79- idx_settings = self .client .indices .get (index = idx )[idx ]['settings' ]['index' ]
79+ idx_settings = meta_getter (self .client , idx , get = 'settings' )
80+ self .loggit .debug ('Index %s has settings: %s' , idx , idx_settings )
8081 if has_lifecycle_name (idx_settings ):
8182 self .loggit .critical (
8283 'Index %s is associated with an ILM policy and this action will never work on '
@@ -85,13 +86,16 @@ def action_generator(self):
8586 if is_idx_partial (idx_settings ):
8687 self .loggit .critical ('Index %s is already in the frozen tier' , idx )
8788 raise SearchableSnapshotException ('Index is already in frozen tier' )
89+
8890 snap = idx_settings ['store' ]['snapshot' ]['snapshot_name' ]
8991 snap_idx = idx_settings ['store' ]['snapshot' ]['index_name' ]
9092 repo = idx_settings ['store' ]['snapshot' ]['repository_name' ]
91- aliases = self .client .indices .get (index = idx )[idx ]['aliases' ]
93+ msg = f'Index { idx } Snapshot name: { snap } , Snapshot index: { snap_idx } , repo: { repo } '
94+ self .loggit .debug (msg )
95+
96+ aliases = meta_getter (self .client , idx , get = 'alias' )
9297
93- prefix = get_frozen_prefix (snap_idx , idx )
94- renamed = f'{ prefix } { snap_idx } '
98+ renamed = f'partial-{ idx } '
9599
96100 if not self .index_settings :
97101 self .index_settings = {
@@ -187,7 +191,7 @@ def cleanup(self, current_idx, newidx):
187191 def do_action (self ):
188192 """
189193 Do the actions outlined:
190-
194+ Extract values from generated kwargs
191195 Mount
192196 Verify
193197 Update Aliases
0 commit comments