Comments (2)
To workaround the above issue we can use dnspython to perform our dns lookups.
copy /usr/local/lib/pyenv/versions/3.6.8/lib/python3.6/site-packages/artemis_utils/service.py locally. The below code replaces ' service_to_ips_and_replicas_in_compose' with a dnspython definition
artemis_utils will require dnspython module
`
def resolve_dns(query:str, rtype:str = 'A', timeout:int = 2)->list:
rtype.upper()
resolver = dns.resolver.Resolver()
if rtype == "PTR":
query = dns.reversename.from_address(query)
msg = dns.message.make_query(query,rtype)
for dns_server in resolver.nameservers:
try:
resp = dns.query.udp(msg,dns_server,timeout=timeout)
if resp.answer:
return [str(a) for a in resp.answer[0] ]
except Exception as e:
log.error("error:",dns_server, e)
return []
def service_to_ips_and_replicas_in_compose(own_service_name, base_service_name):
local_ip = get_local_ip()
address_regexp = re.compile ('\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}')
service_to_ips_and_replicas_set = set([])
addr_infos = resolve_dns(base_service_name)
for replica_ip in addr_infos:
# do not include yourself
if base_service_name == own_service_name and replica_ip == local_ip:
continue
ptr = resolve_dns(replica_ip, 'PTR')
for replica_host_by_addr in ptr:
replica_name_match = re.match(
r"^"
+ re.escape(COMPOSE_PROJECT_NAME)
+ r"[_|-]"
+ re.escape(base_service_name)
+ r"_|-",
replica_host_by_addr,
)
if replica_name_match:
replica_name = "{}-{}".format(base_service_name, replica_name_match.group(1))
service_to_ips_and_replicas_set.add((replica_name, replica_ip))
return service_to_ips_and_replicas_set
`
from artemis.
@mooneym17 thanks for reporting this! Could you issue a PR with the potential fix? We will also update Artemis utils accordingly with the fix. Thank you!
from artemis.
Related Issues (20)
- README architecture link is incorrect
- Re-evaluate the RPKI state when new routing advertisements come in HOT 2
- Unable to activate microservices in microk8s cluster HOT 4
- Remove process parallelism from re-configuration task
- No Mail sending HOT 4
- ARTEMIS Lite design and PoC HOT 5
- Don't load config file or modulies HOT 5
- Use with proxy HOT 4
- pg-amqp-bridge docker image HOT 2
- PostgreSQL Version Update HOT 1
- Disk full after some time HOT 2
- Routinator Fails to Start HOT 1
- Standard SYSLOG Handler Causes Multiple Containers to Fail to Startu (Ubuntu 20.04) HOT 4
- Writing Hijacks to SYSLOG to be consumed by Splunk (etc) HOT 1
- Not working after update HOT 2
- artemis-database fails on a fresh install in kubernetes HOT 1
- Running on k8s with tight security results in configuration container crash HOT 2
- non-root user enabled images and k8s securityContext additions
- ARM64 Debian Linux 11 docker compose operation fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from artemis.