Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.1.2 #18

Merged
merged 24 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8eca715
Update the requirements of urllib3 for security, and also loosen requ…
sean-gallagher-redvest Nov 5, 2021
6b74b54
Fix test apparatus, and run the tests Ryan wrote.
sean-gallagher-redvest Nov 5, 2021
38e6122
Setup CodeQL analysis
sean-gallagher-redvest Nov 5, 2021
2f0c069
Run vericode automatically on push
sean-gallagher-redvest Nov 5, 2021
a10cece
Merge pull request #10 from lowes/features/automatic-vericode
sean-gallagher-redvest Nov 5, 2021
50b6160
Merge pull request #9 from lowes/feature/codeql
sean-gallagher-redvest Nov 5, 2021
01daf77
Clean up formatting in README
sean-gallagher-redvest Nov 5, 2021
bcfe92f
Setup continuous integration with Python
sean-gallagher-redvest Nov 5, 2021
8fa657c
Require kerberos be installed to initiate tests
sean-gallagher-redvest Nov 5, 2021
f815241
Package installation requires sudo on Github
sean-gallagher-redvest Nov 5, 2021
07a8157
Don't target Python 3.10 yet
sean-gallagher-redvest Nov 5, 2021
8ced3ca
Merge pull request #12 from lowes/feature/clean-readme
sean-gallagher-redvest Nov 5, 2021
e7c7c50
Merge pull request #13 from lowes/feature/setup-pytest
sean-gallagher-redvest Nov 5, 2021
e373587
Setup Python PyPI package
sean-gallagher-redvest Nov 5, 2021
cc50727
Expand testing, particularly Minio
sean-gallagher-redvest Nov 9, 2021
e002519
Merge branch 'development' into feature/test-minio
sean-gallagher-redvest Nov 9, 2021
e99a3d7
Merge pull request #14 from lowes/features/publish-pypi
sean-gallagher-redvest Nov 9, 2021
cc00757
Merge branch 'development' into feature/test-minio
sean-gallagher-redvest Nov 9, 2021
5a4ac3d
Include minio in python package building
sean-gallagher-redvest Nov 9, 2021
4273105
Clean up tests to not require lvfs.yml
sean-gallagher-redvest Nov 9, 2021
434b8d8
Drop Python 3.6 support
sean-gallagher-redvest Nov 9, 2021
ed6101f
Merge pull request #16 from lowes/feature/test-minio
sean-gallagher-redvest Nov 9, 2021
ba471cc
Bugfix release 1.1.2
sean-gallagher-redvest Nov 9, 2021
484150b
Merge pull request #17 from lowes/feature/release-1.1.2
sean-gallagher-redvest Nov 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main, development ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, development ]
schedule:
- cron: '42 3 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
46 changes: 46 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ main, development ]
pull_request:
branches: [ main, development ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# Kerberos must be installed for kerberos support
sudo apt-get install -f libkrb5-dev
# Minio support
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
sudo mv minio /usr/bin/minio
python -m pip install --upgrade pip
python -m pip install flake8 pytest flit
flit install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 7 additions & 1 deletion .github/workflows/uploadandscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
name: Vericode Scan

on:
workflow_dispatch
push:
branches: [ main, development ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, development ]
schedule:
- cron: '42 3 * * 5'

jobs:
build:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ credentials:
# In Yaml the - indiciates this is a list element.
# Any additional stanzas will start with a similar -
- realm:
# LVFS uses realms to determine which set of credentials to use for each URL.
# LVFS uses realms to determine which set of credentials to use for each URL.
# Every credential stanza gets one realm.
# LVFS will use the first stanza that matches the URL.
# In this case we match anything using HDFSOverSSH
Expand Down Expand Up @@ -134,7 +134,7 @@ processing within the cluster. In that case, configuration is a lot easier.
```yaml
credentials:
- realm:
# For historic reasons, all HDFS connections use the HDFSOverSSH connection class
# For historic reasons, all HDFS connections use the HDFSOverSSH connection class
# because SSH will be disabled when you don't configure it here.
classname: HDFSOverSSH
# This is the Hadoop username; there is no jumpbox
Expand Down Expand Up @@ -207,11 +207,11 @@ At any rate, this is not been tested with LVFS.
For later reference, these are the possible modes for HDFSOverSSH:

ssh_jump_host | ssh_username | username | password | webhdfs_root | use case
--------------|--------------|----------|----------|--------------------------------------
* | * | * | * | None | Invalid, unconfigured
not None | None | * | * | * | Invalid
None | not None | * | * | * | Invalid
* | * | None | not None | * | Invalid
------------- | ------------ | -------- | -------- | ------------ | --------
(any) | (any) | (any) | (any) | None | Invalid, unconfigured
not None | None | (any) | (any) | (any) | Invalid
None | not None | (any) | (any) | (any) | Invalid
(any) | (any) | None | not None | (any) | Invalid
not None | not None | not None | None | not None | HDP2 with SSH
None | None | not None | None | not None | HDP2 without SSH
not None | not None | not None | not None | not None | HDP3+AD with SSH
Expand Down
2 changes: 1 addition & 1 deletion lvfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Artifactory, for model and code reading and writing
"""

__version__ = "1.1.1"
__version__ = "1.1.2"
__all__ = ["URL"]
import copyreg
import urllib
Expand Down
2 changes: 1 addition & 1 deletion lvfs/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def init_register(cls, search_paths: List[Path] = None):
location: List of Paths to try to read the configuration from (must be local)

If location is not specified, the following locations will be searched:
* `./lvfs.conf`
* `./lvfs.yml`
* `~/.config/lvfs.yml`
* `/etc/creds/lvfs.yml`
* `/etc/secret/lvfs.yml`
Expand Down
47 changes: 34 additions & 13 deletions lvfs/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __bucket(self, required=True):
raise ValueError(f"No bucket specified for Minio URL {self}")
return bucket

def __path_without_bucket(self, required=True):
def __path_without_bucket(self):
""" Get the path without the bucket from this URL.

Accepts
Expand All @@ -67,22 +67,18 @@ def __path_without_bucket(self, required=True):
"""
path = self.path
path = path[1:] if path.startswith("/") else path
path = path.split("/", 1)[1] if "/" in path else None
path = path or None
if required and not path:
raise ValueError(f"No path specified for Minio URL {self}")
return path
return path.split("/", 1)[1] if "/" in path else ""

def __connect(self):
creds = self.__creds
if creds not in self.__clients:
self.__clients[creds] = minio.Minio(
host, creds = self.host, self.__creds
if (host, creds) not in self.__clients:
self.__clients[(host, creds)] = minio.Minio(
self.host,
access_key=creds[0],
secret_key=creds[1],
secure=creds[2]
)
return self.__clients[creds]
return self.__clients[(host, creds)]

@_wrap_error
async def read_binary(self) -> bytes:
Expand Down Expand Up @@ -122,12 +118,12 @@ async def ls(self, recursive: bool = False) -> List[URL]:
""" Get the list of files in this directory, if it is one

Returns a list of URL objects. Results are always absolute.
*DO NOT `root.join(file)`*
"""
bucket = self.__bucket()
if bucket:
prefix = self.__path_without_bucket()
prefix = prefix if prefix.endswith("/") else prefix + "/"
if prefix and not prefix.endswith("/"):
prefix = prefix + "/"
return [
# These paths are relative to the bucket, but join()
# is relative to this prefix. So slice it off.
Expand Down Expand Up @@ -175,13 +171,38 @@ async def mkdir(self, ignore_if_exists: bool = False):
ignore_if_exists: boolean: DEPRECATED
Included for backward compatibility. Existing directories are always ignored.
"""
# This doesn't really exist
# This doesn't really exist, but it sorta does for buckets

@_wrap_error
async def make_bucket(self):
""" Create a bucket.

The path is not used and no folders are created.
For filesystems without buckets, this method has no effect.
In other filesystems you may need special permissions to create buckets.
Creating buckets programmatically may be unwise on account of billing.
"""
self.__connect().make_bucket(self.__bucket())

def supports_permissions(self) -> bool:
""" Some implementations, like blobs, do not always support permissions,
If this method returns true, the file system supports permissions
"""
return False

def supports_directories(self) -> bool:
""" Return whether the protocol supports first-class directories.

Notes
-----
If the filesystems support directories, then:
- mkdir() and isdir() have meaning
- mkdir() followed by isdir() should be True
Otherwise:
- mkdir() has no effect and isdir() degrades to best-effort
which usually means it will only be True if the directory has content
"""
return False

@_wrap_error
async def unlink(self, ignore_if_missing: bool = False):
Expand Down
Loading