This file is indexed.

/usr/lib/python2.7/dist-packages/curator/validators/options.py is in python-elasticsearch-curator 4.2.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
from voluptuous import *
from ..defaults import settings

### Schema information ###

def allocation_type():
    return { Optional('allocation_type', default='require'): All(
        Any(str, unicode), Any('require', 'include', 'exclude')) }

def continue_if_exception():
    return { Optional('continue_if_exception', default=False): Boolean() }

def count():
    return { Required('count'): All(Coerce(int), Range(min=0, max=10)) }

def delay():
    return {
        Optional('delay', default=0): All(
                Coerce(float), Range(min=0.0, max=3600.0)
            )
    }

def delete_aliases():
    return { Optional('delete_aliases', default=False): Boolean() }

def disable_action():
    return { Optional('disable_action', default=False): Boolean() }

def extra_settings():
    return { Optional('extra_settings', default={}): dict }

def ignore_empty_list():
    return { Optional('ignore_empty_list', default=False): Boolean() }

def ignore_unavailable():
    return { Optional('ignore_unavailable', default=False): Boolean() }

def include_aliases():
    return { Optional('include_aliases', default=False): Boolean() }

def include_global_state():
    return { Optional('include_global_state', default=True): Boolean() }

def indices():
    return { Optional('indices', default=None): Any(None, list) }

def key():
    return { Required('key'): Any(str, unicode) }

def max_num_segments():
    return {
        Required('max_num_segments'): All(Coerce(int), Range(min=1, max=32768))
    }

def name(action):
    if action in ['alias', 'create_index']:
        return { Required('name'): Any(str, unicode) }
    elif action == 'snapshot':
        return {
            Optional('name', default='curator-%Y%m%d%H%M%S'): Any(str, unicode)
        }
    elif action == 'restore':
        return { Optional('name'): Any(str, unicode) }

def partial():
    return { Optional('partial', default=False): Boolean() }

def rename_pattern():
    return { Optional('rename_pattern'): Any(str, unicode) }

def rename_replacement():
    return { Optional('rename_replacement'): Any(str, unicode) }

def repository():
    return { Required('repository'): Any(str, unicode) }

def retry_count():
    return {
        Optional('retry_count', default=3): All(
                Coerce(int), Range(min=0, max=100)
            )
    }

def retry_interval():
    return {
        Optional('retry_interval', default=120): All(
                Coerce(int), Range(min=1, max=600)
            )
    }

def routing_type():
    return { Required('routing_type'): Any('allocation', 'rebalance') }

def cluster_routing_setting():
    return { Required('setting'): Any('enable') }

def cluster_routing_value():
    return {
        Required('value'): Any(
                'all', 'primaries', 'none', 'new_primaries', 'replicas'
            )
    }

def skip_repo_fs_check():
    return { Optional('skip_repo_fs_check', default=False): Boolean() }

def timeout_override(action):
    if action in ['forcemerge', 'restore', 'snapshot']:
        return {
            Optional('timeout_override', default=21600): Any(Coerce(int), None)
        }
    if action in ['close']:
        # This is due to the synced flush operation before closing.
        return {
            Optional('timeout_override', default=180): Any(Coerce(int), None)
        }
    else:
        return {
            Optional('timeout_override', default=None): Any(Coerce(int), None)
        }

def value():
    return { Required('value'): Any(str, unicode) }



def wait_for_completion(action):
    if action in ['allocation', 'cluster_routing', 'replicas']:
        return { Optional('wait_for_completion', default=False): Boolean() }
    elif action in ['restore', 'snapshot']:
        return { Optional('wait_for_completion', default=True): Boolean() }

## Methods for building the schema
def action_specific(action):
    options = {
        'alias' : [
            name(action),
            extra_settings(),
        ],
        'allocation' : [
            key(),
            value(),
            allocation_type(),
            wait_for_completion(action),
        ],
        'close' : [ delete_aliases() ],
        'cluster_routing' : [
            routing_type(),
            cluster_routing_setting(),
            cluster_routing_value(),
            wait_for_completion(action),
        ],
        'create_index' : [
            name(action),
            extra_settings(),
        ],
        'delete_indices' : [],
        'delete_snapshots' : [
            repository(),
            retry_interval(),
            retry_count(),
        ],
        'forcemerge' : [
            delay(),
            max_num_segments(),
        ],
        'open' : [],
        'replicas' : [
            count(),
            wait_for_completion(action),
        ],
        'restore' : [
            repository(),
            name(action),
            indices(),
            ignore_unavailable(),
            include_aliases(),
            include_global_state(),
            partial(),
            rename_pattern(),
            rename_replacement(),
            extra_settings(),
            wait_for_completion(action),
            skip_repo_fs_check(),
        ],
        'snapshot' : [
            repository(),
            name(action),
            ignore_unavailable(),
            include_global_state(),
            partial(),
            wait_for_completion(action),
            skip_repo_fs_check(),
        ],
    }
    return options[action]

def get_schema(action):
    # Appending the options dictionary seems to be the best way, since the
    # "Required" and "Optional" elements are hashes themselves.
    options = {}
    defaults = [
        continue_if_exception(),
        disable_action(),
        ignore_empty_list(),
        timeout_override(action),
    ]
    for each in defaults:
        options.update(each)
    for each in action_specific(action):
        options.update(each)
    return Schema(options)