-
Notifications
You must be signed in to change notification settings - Fork 0
/
ceph-ls.sh
executable file
·38 lines (33 loc) · 954 Bytes
/
ceph-ls.sh
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
#!/bin/bash
# Copyright (c) 2023 Ho Kim ([email protected]). All rights reserved.
# Use of this source code is governed by a GPL-3-style license that can be
# found in the LICENSE file.
# Prehibit errors
set -e -o pipefail
###########################################################
# Main Function #
###########################################################
for cluster_config_file in $(
find "$(pwd)/clusters" \
-maxdepth 1 \
-mindepth 1 \
-type f |
sort
); do
# Skip if not .yaml
if
! echo "${cluster_config_file}" |
grep -Po '\.yaml$' >/dev/null
then
continue
fi
# Skip if not regular file
if
! echo "${cluster_config_file}" |
grep -Po '^/(.+/)*\K[0-9a-z-]+\.yaml$' >/dev/null
then
continue
fi
echo "${cluster_config_file}" |
grep -Po '^/(.+/)*\K[0-9a-z-]+'
done