Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Apr 20, 2019
1 parent c2a8590 commit 63eff29
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions datadog_checks_downloader/datadog_checks/downloader/download.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)


import glob
import logging
import logging.config
Expand All @@ -11,18 +9,16 @@
import shutil
import tempfile

import tuf.settings

# Import what we need from in-toto.
from in_toto import verifylib
from in_toto.models.metadata import Metablock
from in_toto.util import import_public_keys_from_files_as_dict

# Other 3rd-party imports.
# NOTE: We assume that setuptools is installed by default.
from pkg_resources import parse_version

# Import what we need from TUF.
from tuf import settings as tuf_settings
from tuf.client.updater import Updater
from tuf.exceptions import UnknownTargetError

Expand All @@ -46,10 +42,10 @@
from .parameters import substitute

# Turn off TUF file logging.
tuf.settings.ENABLE_FILE_LOGGING = False
# Increase requests timeout.
tuf.settings.SOCKET_TIMEOUT = 60
tuf_settings.ENABLE_FILE_LOGGING = False

# Increase requests timeout.
tuf_settings.SOCKET_TIMEOUT = 60

# After we import everything we neeed, shut off all existing loggers.
logging.config.dictConfig({'disable_existing_loggers': True, 'version': 1})
Expand Down Expand Up @@ -88,7 +84,7 @@ def __init__(self, verbose=0):
assert level in range(10, 70, 10), level
logging.basicConfig(format='%(levelname)-8s: %(message)s', level=level)

tuf.settings.repositories_directory = REPOSITORIES_DIR
tuf_settings.repositories_directory = REPOSITORIES_DIR

# NOTE: The directory where the targets for *this* repository is
# cached. We hard-code this keep this to a subdirectory dedicated to
Expand Down Expand Up @@ -189,7 +185,7 @@ def __verify_in_toto_metadata(self, target_relpath, in_toto_inspection_packet):

try:
verifylib.in_toto_verify(layout, layout_key_dict, substitution_parameters=params)
except:
except Exception:
logger.exception('in-toto failed to verify {}'.format(target_relpath))
raise
else:
Expand Down

0 comments on commit 63eff29

Please sign in to comment.