This commit is contained in:
meejah 2019-04-08 18:58:39 -06:00
parent 4665617818
commit 2cf36cf884
4 changed files with 7 additions and 10 deletions

View File

@ -31,13 +31,11 @@ from allmydata.util.abbreviate import parse_abbreviated_size
from allmydata.util.time_format import parse_duration, parse_date
from allmydata.util.i2p_provider import create as create_i2p_provider
from allmydata.util.tor_provider import create as create_tor_provider
from allmydata.util.base32 import a2b, b2a
from allmydata.stats import StatsProvider
from allmydata.history import History
from allmydata.interfaces import IStatsProducer, SDMF_VERSION, MDMF_VERSION, DEFAULT_MAX_SEGMENT_SIZE
from allmydata.nodemaker import NodeMaker
from allmydata.blacklist import Blacklist
from allmydata import node
KiB=1024

View File

@ -72,7 +72,7 @@ class AddGridManagerCertOptions(BaseOptions):
"Must provide --filename option"
)
if self['filename'] == '-':
print >>self.parent.parent.stderr, "reading certificate from stdin"
print("reading certificate from stdin", file=self.parent.parent.stderr)
data = sys.stdin.read()
if len(data) == 0:
raise usage.UsageError(
@ -82,7 +82,7 @@ class AddGridManagerCertOptions(BaseOptions):
try:
self.certificate_data = parse_grid_manager_data(data)
except ValueError as e:
print >>self.parent.parent.stderr, "Error parsing certificate: {}".format(e)
print("Error parsing certificate: {}".format(e), file=self.parent.parent.stderr)
self.certificate_data = None
else:
with open(self['filename'], 'r') as f:
@ -118,10 +118,10 @@ def add_grid_manager_cert(options):
cert_fname = "{}.cert".format(options['name'])
cert_path = config.get_config_path(cert_fname)
cert_bytes = json.dumps(options.certificate_data, indent=4) + '\n'
cert_name = options['name']
# cert_name = options['name']
if exists(cert_path):
print >>options.parent.parent.stderr, "Already have file '{}'".format(cert_path)
print("Already have file '{}'".format(cert_path), file=options.parent.parent.stderr)
return 1
cfg = config.config # why aren't methods we call on cfg in _Config itself?
@ -141,7 +141,7 @@ def add_grid_manager_cert(options):
cfg.write(f)
# print("wrote {}".format(config_fname))
print >>options.parent.parent.stderr, "There are now {} certificates".format(len(gm_certs))
print("There are now {} certificates".format(len(gm_certs)), file=options.parent.parent.stderr)
return 0

View File

@ -1,5 +1,5 @@
from __future__ import print_function
import os
import sys
import json
import time

View File

@ -43,7 +43,6 @@ from pycryptopp.publickey import ed25519 # perhaps NaCl instead? other code use
from allmydata.interfaces import IStorageBroker, IDisplayableServer, IServer
from allmydata.util import log, base32, connection_status
from allmydata.util import keyutil
from allmydata.util.assertutil import precondition
from allmydata.util.observer import ObserverList
from allmydata.util.rrefutil import add_version_to_remote_reference
@ -304,7 +303,7 @@ def parse_grid_manager_data(gm_data):
k,
)
)
for k in allowed_keys:
for k in required_keys:
if k not in js:
raise ValueError(
"Grid Manager certificate JSON must contain '{}'".format(