mirror of
https://github.com/getsops/sops.git
synced 2026-02-05 12:45:21 +01:00
Merge pull request #319 from rouge8/fix-travis
[PYTHON] Fix Travis builds
This commit is contained in:
15
.travis.yml
15
.travis.yml
@@ -28,23 +28,12 @@ matrix:
|
||||
language: generic
|
||||
osx_image: xcode7.3
|
||||
env: SYSTEM_TEST=1
|
||||
# test on osx yosemite
|
||||
- os: osx
|
||||
sudo: required
|
||||
language: generic
|
||||
osx_image: xcode7.1
|
||||
env: SYSTEM_TEST=1
|
||||
# test with default python on trusty and precise
|
||||
# test with default python on trusty
|
||||
- os: linux
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: generic
|
||||
env: SYSTEM_TEST=1
|
||||
- os: linux
|
||||
sudo: required
|
||||
dist: precise
|
||||
language: generic
|
||||
env: SYSTEM_TEST=1
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -55,7 +44,7 @@ addons:
|
||||
- gnupg
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libffi libyaml gpg2; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libyaml; brew upgrade gnupg; fi
|
||||
install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" && ! -z $TOX_ENV ]]; then pip install tox; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [ $SYSTEM_TEST -eq 1 ]; then sudo pip install -r requirements.txt; else pip install -r requirements.txt; fi; fi
|
||||
|
||||
2
Makefile
2
Makefile
@@ -77,7 +77,7 @@ functional-tests-once:
|
||||
dd if=/dev/urandom of=/tmp/testdata-randomfile bs=1024 count=1024 2>&1 1>/dev/null
|
||||
python sops/__init__.py -e -p "1022470DE3F0BC54BC6AB62DE05550BC07FB1A0A" /tmp/testdata-randomfile > /tmp/testdata-randomfile.enc
|
||||
python sops/__init__.py -d /tmp/testdata-randomfile.enc > /tmp/testdata-randomfile.dec
|
||||
if [ $$(sha256sum /tmp/testdata-randomfile | cut -d ' ' -f 1) != $$(sha256sum /tmp/testdata-randomfile.dec | cut -d ' ' -f 1) ]; then \
|
||||
if [ $$(shasum -a 256 /tmp/testdata-randomfile | cut -d ' ' -f 1) != $$(shasum -a 256 /tmp/testdata-randomfile.dec | cut -d ' ' -f 1) ]; then \
|
||||
echo "Binary file roundtrip failed, checksum doesn't match"; exit 0; \
|
||||
else \
|
||||
echo "Binary file roundtrip succeeded"; \
|
||||
|
||||
@@ -416,7 +416,7 @@ def initialize_tree(path, itype, kms_arns=None, pgp_fps=None, configloc=None,
|
||||
need_key = False
|
||||
try:
|
||||
existing_file = os.stat(path)
|
||||
except:
|
||||
except Exception:
|
||||
existing_file = False
|
||||
if existing_file:
|
||||
# read the encrypted file from disk
|
||||
@@ -431,13 +431,13 @@ def initialize_tree(path, itype, kms_arns=None, pgp_fps=None, configloc=None,
|
||||
try:
|
||||
global INPUT_VERSION
|
||||
INPUT_VERSION = tree['sops']['version']
|
||||
except:
|
||||
except Exception:
|
||||
None
|
||||
# try to set the unencrypted suffix to the one set in the file
|
||||
try:
|
||||
global UNENCRYPTED_SUFFIX
|
||||
UNENCRYPTED_SUFFIX = tree['sops']['unencrypted_suffix']
|
||||
except:
|
||||
except Exception:
|
||||
None
|
||||
else:
|
||||
# The file does not exist, create a new tree using DEFAULT data
|
||||
@@ -487,7 +487,7 @@ def load_file_into_tree(path, filetype, restore_sops=None):
|
||||
object_pairs_hook=OrderedDict)
|
||||
if "version" not in tree['sops']:
|
||||
tree['data'] = data
|
||||
except:
|
||||
except Exception:
|
||||
tree = OrderedDict()
|
||||
valre = b'(.+)^SOPS=({.+})$'
|
||||
res = re.match(valre, data, flags=(re.MULTILINE | re.DOTALL))
|
||||
@@ -516,7 +516,7 @@ def find_config_for_file(filename, configloc):
|
||||
for i in range(DEFAULT_CONFIG_FILE_SEARCH_DEPTH):
|
||||
try:
|
||||
os.stat((i * "../") + DEFAULT_CONFIG_FILE)
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
# when we find a file, exit the loop
|
||||
configloc = (i * "../") + DEFAULT_CONFIG_FILE
|
||||
@@ -1180,14 +1180,14 @@ def get_aws_session_for_entry(entry):
|
||||
return (None, "Invalid ARN '%s' in entry" % entry['arn'])
|
||||
try:
|
||||
region = res.group(1)
|
||||
except:
|
||||
except Exception:
|
||||
return (None, "Unable to find region from ARN '%s' in entry" %
|
||||
entry['arn'])
|
||||
# if there are no role to assume, return the client directly
|
||||
if not ('role' in entry):
|
||||
try:
|
||||
cli = boto3.client('kms', region_name=region)
|
||||
except:
|
||||
except Exception:
|
||||
return (None, "Unable to get boto3 client in %s" % region)
|
||||
return (cli, "")
|
||||
# otherwise, create a client using temporary tokens that assume the role
|
||||
@@ -1331,7 +1331,7 @@ def write_file(tree, path=None, filetype=None):
|
||||
else:
|
||||
try:
|
||||
fd.write(tree['data'].encode('utf-8'))
|
||||
except:
|
||||
except Exception:
|
||||
fd.write(tree['data'])
|
||||
if 'sops' in tree:
|
||||
jsonstr = json.dumps(tree['sops'], sort_keys=True)
|
||||
@@ -1521,7 +1521,7 @@ def check_latest_version():
|
||||
else:
|
||||
print("INFO: to update to sops " + latest + ", use:"
|
||||
" $ pip install sops=="+latest)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user