Skip to content

Commit

Permalink
Merge pull request #85 from jcpunk/pre-commit
Browse files Browse the repository at this point in the history
Setup pre-commit with useful plugins
  • Loading branch information
brianhlin authored Apr 1, 2024
2 parents 097ebaf + 47bdd83 commit b80a415
Show file tree
Hide file tree
Showing 25 changed files with 655 additions and 447 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8e52306f85582ea626aa3e745547542d35ddae53
2 changes: 1 addition & 1 deletion .github/workflows/build-sw-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
6 changes: 3 additions & 3 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: run python unit tests
on:
push:
pull_request:

jobs:
run-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: install m2crypto
run: sudo apt-get install m2crypto

- name: execute tests
run: python3 -m unittest discover -v tests
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v4.1.0
hooks:
- id: check-ast
- id: check-docstring-first
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-toml
- repo: "https://github.com/pycqa/isort"
rev: 5.11.5
hooks:
- id: isort
- repo: "https://github.com/psf/black"
rev: 22.3.0
hooks:
- id: black
- repo: "https://github.com/asottile/pyupgrade"
rev: v3.15.1
hooks:
- id: pyupgrade
args:
- "--py39-plus"
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ env:
matrix:
- OS_TYPE=centos OS_VERSION=6
- OS_TYPE=centos OS_VERSION=7

services:
- docker

before_install:
- sudo apt-get update
- echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
- sudo service docker restart
- sleep 5
- sudo docker pull centos:centos${OS_VERSION}


script:
# Run tests in Container
- tests/setup_tests.sh ${OS_VERSION}
- tests/setup_tests.sh ${OS_VERSION}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN yum update -y && \
python3 setup.py install --root=/ && \
mkdir -p /etc/osg/pki && \
cp /usr/local/config/ca-issuer.conf /etc/osg/pki/

WORKDIR /output

ENTRYPOINT ["/usr/local/bin/osg-cert-request"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ Usage: osg-incommon-cert-request [--debug] -u username -k pkey -c cert \
osg-incommon-cert-request --version
```

See osg-incommon-cert-request -h or the
See osg-incommon-cert-request -h or the
[man page](https://htmlpreview.github.io/?https://github.com/opensciencegrid/osg-pki-tools/blob/master/man/osgincommoncertrequest.html)
for a description of the options.
15 changes: 7 additions & 8 deletions man/osg-incommon-cert-request.1
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ osg-incommon-cert-request \- retrieves host and service certificates from the In
.B osg-incommon-cert-request
retrieves host and service certificates from the InCommon IGTF Server CA.
It requires an Incommon user account authorized as a Department
Registration Authority to issue InCommon IGTF Server CA certificates
Registration Authority to issue InCommon IGTF Server CA certificates
with SSL auto approval.
It authenticates the requestor with an InCommon client certificate.
.PP
It allows bulk retrieval of certificates and keys.
It allows bulk retrieval of certificates and keys.
.SH OPTIONS
.PP
.TP
Expand All @@ -37,9 +37,9 @@ Specify requestor's user certificate (PEM format).
Specify requestor's private key (PEM format).
.TP
.BR \-a, \-\-altname
Specify a Subject Alternative Name (SAN) for the requested certificate
Specify a Subject Alternative Name (SAN) for the requested certificate
(only works with
.I \-H, \-\-hostname).
.I \-H, \-\-hostname).
May be specified more than once for additional SANs.
.TP
.BR \-d, \-\-directory
Expand Down Expand Up @@ -71,7 +71,7 @@ To generate a certificate with multiple Subject Alternative Names (SANS)
.nf
osg-incommon-cert-request -u incommonuser -c certpath.pem \\
-k keypath.pem -H hostname.yourdomain -a hostalt.yourdomain \\
-a hostalt2.yourdomain
-a hostalt2.yourdomain
.fi
.RE
.PP
Expand All @@ -83,7 +83,7 @@ osg-incommon-cert-request -u incommonuser -c certpath.pem \\
-k keypath.pem -F hostfilepath.txt
.RE
.PP
hostfilepath.txt example
hostfilepath.txt example
.PP
.RS
hostname01.yourdomain
Expand All @@ -93,7 +93,7 @@ hostname04.yourdomain hostname05.yourdomain
.fi
.RE
.PP
To provide alternative organization and department codes for the InCommon Certificate Service.
To provide alternative organization and department codes for the InCommon Certificate Service.
.PP
.RS
.nf
Expand All @@ -103,4 +103,3 @@ osg-incommon-cert-request -O 4567,8912 -u incommonuser \\
.RE
.SH AUTHOR
Jeny Teheran

8 changes: 4 additions & 4 deletions osgpkitools/ExceptionDefinitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def __str__(self):


class FileNotFoundException(Exception):
""" Exception raised when a file is not found
"""Exception raised when a file is not found
Attributes:
filename -- Name of the file that is not found
message -- message to be printed for this exception
"""
"""

def __init__(self, filename, message):
self.filename = filename
Expand All @@ -34,12 +34,12 @@ def __str__(self):


class BadPassphraseException(Exception):
""" This Exception occurs when the passphrase entered for the private key file
"""This Exception occurs when the passphrase entered for the private key file
does not match the stored passphrase of the key file.
Attributes:
message -- message to be displayed
"""
"""

def __init__(self, message):
self.message = message
Expand Down
Loading

0 comments on commit b80a415

Please sign in to comment.