Skip to content

Commit

Permalink
fix module
Browse files Browse the repository at this point in the history
  • Loading branch information
bodsch committed Nov 12, 2024
1 parent 03295cf commit 5874502
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/loki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ jobs:
- with-updates
- "2.5"
- "2.6"
- "2.7"
- "3.2"
collection_role:
- loki

Expand Down
28 changes: 18 additions & 10 deletions plugins/modules/loki_verify_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,28 @@ def run(self):

rc, out, err = self.__exec(args, check_rc=False)

err = err.strip()
# self.module.log(msg=f" -> '{err}' ({type(err)})")

if rc == 0:
_failed = False

if isinstance(err, str):
err = json.loads(err)

if isinstance(err, dict):
error_msg = err.get("err", None)
msg = err.get("msg", None)

if rc != 0 and error_msg:
msg = error_msg.split("\n")
if rc != 0 and len(err) > 0:
if isinstance(err, str):
err = json.loads(err)

if isinstance(err, dict):
# log_level = err.get("level", "info")
error_msg = err.get("err", None)
msg = err.get("msg", None)
# if log_level == "warn":
# msg = error_msg = err.get("msg", None)
if rc != 0 and error_msg:
msg = error_msg.split("\n")
else:
msg = err
else:
msg = err
msg = "unknow config error."

result = dict(
failed=_failed,
Expand Down
14 changes: 14 additions & 0 deletions roles/loki/molecule/2.6/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ loki_config_server:
http_listen_address: "127.0.0.1"
http_listen_port: 3100

loki_config_schema:
configs:
- from: "2020-10-24"
store: boltdb # tsdb #
object_store: filesystem
schema: v11 # v13 #
index:
prefix: index_
period: 168h # 24h #
chunks:
prefix: index_
period: 168h
row_shards: 16

...
16 changes: 15 additions & 1 deletion roles/loki/molecule/2.7/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
---

loki_version: "2.6.1"
loki_version: "2.7.4"

loki_config_server:
http_listen_address: "127.0.0.1"
http_listen_port: 3100

loki_config_schema:
configs:
- from: "2020-10-24"
store: boltdb # tsdb #
object_store: filesystem
schema: v11 # v13 #
index:
prefix: index_
period: 168h # 24h #
chunks:
prefix: index_
period: 168h
row_shards: 16

...
10 changes: 5 additions & 5 deletions roles/loki/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ loki_defaults_config_chunk_store: {}

loki_defaults_config_schema:
configs:
- from: "2020-10-24"
store: boltdb # tsdb #
- from: "2024-01-01"
store: tsdb # tsdb #
object_store: filesystem
schema: v11 # v13 #
schema: v13 # v13 #
index:
prefix: index_
period: 168h # 24h #
period: 24h # 24h #
chunks:
prefix: index_
period: 168h
period: 24h
row_shards: 16

loki_defaults_config_limits:
Expand Down

0 comments on commit 5874502

Please sign in to comment.