forked from access-ci-org/Basic_Cluster
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from diedpigs/feat-variable-backend-server
Use variables for http proxy backend hosts
- Loading branch information
Showing
5 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
import grp | ||
import sys | ||
import rewritemap_config as cfg | ||
import rewrite_map_config as cfg | ||
|
||
while sys.stdin: | ||
hostname = "" | ||
try: | ||
username = sys.stdin.readline().strip() ## It is very important to use strip! | ||
if cfg.DEBUG: print(username) | ||
if not username: | ||
print(cfg.default_hostname) | ||
if username in grp.getgrnam(cfg.target_grp).gr_mem: | ||
print(cfg.target_hostname) | ||
else: | ||
print(cfg.default_hostname) | ||
sys.stdout.flush() | ||
if cfg.DEBUG: | ||
print("username: ", username) | ||
|
||
if username: | ||
for group in cfg.target_groups: | ||
if cfg.DEBUG: | ||
print("Checking group: ", group) | ||
print("\t", grp.getgrnam(group).gr_mem) | ||
|
||
if username in grp.getgrnam(group).gr_mem: | ||
hostname = cfg.target_groups[group] | ||
break | ||
|
||
if not hostname: | ||
hostname = cfg.default_hostname | ||
|
||
except: | ||
print(cfg.default_hostname) | ||
sys.stdout.flush() | ||
hostname = cfg.default_hostname | ||
|
||
print(hostname) | ||
sys.stdout.flush() | ||
if cfg.DEBUG: | ||
break |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DEBUG = False | ||
target_groups = { | ||
{% for group in target_groups %} | ||
"{{ group.name }}": "{{ group.host }}", | ||
{% endfor %} | ||
} | ||
{% for group in target_groups %} | ||
{% if group.default %} | ||
default_hostname = "{{ group.host }}" | ||
{% endif %} | ||
{% endfor %} |