Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File server counts as "accountconsumer" #45

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions imageroot/actions/configure-module/90bind_user_domain
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

# This script is linked to
# - configure-module
# - update-module.d/

import agent
import sys
import os
import json

rdb = agent.redis_connect()
module_id = os.environ["MODULE_ID"]
has_file_server_flag = bool(rdb.sismember(f'module/{module_id}/flags', 'file_server'))
if has_file_server_flag:
domain = os.environ['REALM'].lower()
agent.bind_user_domains([domain], check=False)
else:
agent.bind_user_domains([], check=False)
8 changes: 8 additions & 0 deletions imageroot/bin/write-user-portal-config
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import json
agent_install_dir = os.environ['AGENT_INSTALL_DIR']
# realm is mandatory we do not need to test it
realm = os.environ["REALM"].lower()
module_id = os.environ["MODULE_ID"]

with agent.redis_connect(use_replica=True) as rdb:
modules_set = set()
Expand All @@ -36,6 +37,13 @@ try:
except Exception as ex:
print(agent.SD_WARNING + "Failed to run cluster/list-modules action:", ex, file=sys.stderr)

# A Domain Controller acting as File Server provides additional services
# by itself. Let's tell the user about it:
has_file_server_flag = bool(rdb.sismember(f'module/{module_id}/flags', 'file_server'))
if has_file_server_flag:
names_set.add("Windows authentication")
names_set.add("Network shared folders")

# Write modules set to a JSON file
data = {"domain": realm, "services": list(names_set)}

Expand Down
1 change: 1 addition & 0 deletions imageroot/update-module.d/90bind_user_domain
Loading