[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] 44/45: updated README, cleanup, PEP8
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] 44/45: updated README, cleanup, PEP8 |
Date: |
Fri, 25 Jan 2019 10:02:44 +0100 |
This is an automated email from the git hooks/post-receive script.
rexxnor pushed a commit to branch master
in repository ascension.
commit 6c119818deba8524d848d79eb7540f24ed04e1eb
Author: rexxnor <address@hidden>
AuthorDate: Sun Jan 20 14:38:31 2019 +0100
updated README, cleanup, PEP8
---
README.md | 13 +++++++++----
ascension/ascension.py | 46 ++++++++++++++--------------------------------
setup.py | 2 +-
3 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index 6ac54af..88bb2af 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
# Ascension
-The main goal is to develop a tool to easily migrate existing DNS Zones to the
-GNU Name System using (incremental) Zone Transfers. (AXFR/IXFR)
+Tool to easily migrate existing DNS Zones into the GNU Name System using
+incremental zone transfers (AXFR/IXFR).
## How to install
-To install the ascension simply execute one of the following commands:
+To install the ascension simply execute one of the following commands in the
+freshly cloned directory:
```bash
# System wide installation
@@ -17,6 +18,10 @@ python3 setup.py install
```
## How to install (Developer)
+A developer installation is very handy when you are making changes to the
source
+code as this way you don't need to re-run the installation procedure every time
+you make a change.
+
```bash
# installation through virtualenv
python3 -m venv .venv
@@ -28,7 +33,7 @@ python3 setup.py develop
If you have installed it, simply execute ascension with one of several options.
You can also just run the file ascension.py itself directly.
-Taken from the dosctring of the ascension.py file:
+Taken from the docstring of the ascension.py file:
```
Ascension
diff --git a/ascension/ascension.py b/ascension/ascension.py
index 96a1a90..cd4a549 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -38,6 +38,8 @@ GNUNET_ZONE_CREATION_COMMAND = 'gnunet-identity'
GNUNET_NAMESTORE_COMMAND = 'gnunet-namestore'
GNUNET_GNS_COMMAND = 'gnunet-gns'
GNUNET_ARM_COMMAND = 'gnunet-arm'
+# TODO find better solution for allowed protocols
+SUPPORTED_PROTOCOLS = {'_tcp': 6, '_udp': 17}
# TODO find better solution for ignoring DNSSEC record types
SUPPORTED_RECORD_TYPES = [
"A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME"
@@ -218,7 +220,11 @@ class Ascender():
# build recordline
recordline.append("-R")
- recordline.append("%d %s %s %s" %
+
+ # TODO possible regression here; maybe use a separate
+ # list to pass those arguments to prevent quoting
+ # issues in the future.
+ recordline.append('%d %s %s %s' %
(int(ttl), rdtype, flags, value))
# add recordline to gns
@@ -272,15 +278,18 @@ class Ascender():
:param zonename: zonename of zone to add records to
:param label: label under which to add the records
"""
- logging.info("trying to add %d records with name %s",
len(recordline)/2, label)
+ logging.info("trying to add %d records with name %s",
+ len(recordline)/2, label)
ret = sp.run([GNUNET_NAMESTORE_COMMAND,
'-z', zonename,
'-n', str(label),
] + recordline)
if ret.returncode != 0:
- logging.warning("failed adding record with name %s", '
'.join(ret.args))
+ logging.warning("failed adding record with name %s",
+ ' '.join(ret.args))
else:
- logging.info("successfully added record with name %s", '
'.join(ret.args))
+ logging.info("successfully added record with name %s",
+ ' '.join(ret.args))
@staticmethod
def transform_to_gns_format(record, rdtype, zonename, label):
@@ -337,7 +346,6 @@ class Ascender():
# this is the number for a SRV record
rdtype = 'BOX'
srv = 33
- protocols = {'_tcp': 6, '_udp': 17}
# tearing the record apart
try:
@@ -347,7 +355,7 @@ class Ascender():
return (rdtype, None, None)
priority, weight, destport, target = value.split(' ')
- protonum = protocols.get(proto)
+ protonum = SUPPORTED_PROTOCOLS.get(proto)
if protonum is None:
logging.warning("invalid protocol: %s", proto)
return (rdtype, None, None)
@@ -446,32 +454,6 @@ class Ascender():
ret = soarecord
return ret
- @staticmethod
- def add_srv_record_to_gns(record, zonename):
- """
- Adds a SRV record to GNS
- """
- if not Ascender.check_if_record_exists_in_zone(record, zonename):
- value, ttl, rdata = record
- rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
- dnsname_str = str(rdata).split(' ')[3]
- debug = " ".join([GNUNET_NAMESTORE_COMMAND,
- '-z', zonename,
- '-a', '-n', dnsname_str,
- '-t', rtype_str,
- '-V', str(value),
- '-e', '%ds' % ttl])
- ret = sp.run([GNUNET_NAMESTORE_COMMAND,
- '-z', zonename,
- '-a', '-n', dnsname_str,
- '-t', rtype_str,
- '-V', str(value),
- '-e', '%ds' % ttl])
- logging.info("executed command: %s", debug)
- if ret.returncode != 0:
- logging.warning("failed to add %s record %s",
- rtype_str, dnsname_str)
-
@staticmethod
def add_soa_record_to_gns(record, zonename):
"""
diff --git a/setup.py b/setup.py
index 6a0fd2a..394b172 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="ascension",
- version="0.3.0",
+ version="0.4.0",
author="rexxnor",
author_email="address@hidden",
description="Tool to migrate DNS Zones to the GNU Name System",
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [ascension] 13/45: added zone merging of full and incremental zones, (continued)
- [GNUnet-SVN] [ascension] 13/45: added zone merging of full and incremental zones, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 05/45: initial prototype, bootstrapping zones and zone transfer, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 17/45: updated requirements and README, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 22/45: finished refactoring, fixed a few bugs, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 10/45: added incremental zone transfer logic, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 06/45: working prototype for A, AAAA, MX, CNAME, TXT and more records, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 15/45: created baseclass and separated small from big zones, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 27/45: unstable version, port specification possible, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 28/45: refactored code, added debug mode, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 26/45: added definitive support for IXFR, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 44/45: updated README, cleanup, PEP8,
gnunet <=
- [GNUnet-SVN] [ascension] 43/45: updated dependencies, setup.py, removed TODOs, improved error handling, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 12/45: bumped version to 0.1.0, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 03/45: removed GNU from heading in README, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 02/45: Added LICENSE, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 30/45: updated gnsmigrator and removed c rebuilds, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 08/45: added GNS2DNS support and rudimentary Unittests (incomplete), gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 45/45: renamed files, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 36/45: some experimental fixes, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 34/45: updated gnsmigrator for multiline, added multiline tests, gnunet, 2019/01/25
- [GNUnet-SVN] [ascension] 35/45: unify all records under label, added SUPPORTED_RECORDS global, gnunet, 2019/01/25