Skip to content

Commit

Permalink
docs: autodoc_mock_imports for gssapi
Browse files Browse the repository at this point in the history
Adds mocking of 'gssapi' and 'paramiko[gssapi]' that cannot be installed on ReadTheDocs
builders.

This fixes the ReadTheDocs building problem.

closes reanahub#274
  • Loading branch information
Parth Shandilya committed Oct 9, 2020
1 parent 42b3a99 commit 2fa5221
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include LICENSE
include *.rst
include *.sh
include *.txt
include *.in
include pytest.ini
include docs/openapi.json
include docs/_static/reana-job-manager.xml
Expand Down
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
"sphinxcontrib.redoc",
]

# Autodoc mocking to fix ReadTheDocs builds missing system dependencies
autodoc_mock_imports = ["gssapi", "paramiko[gssapi]"]

redoc = [
{
"page": "_static/api",
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

-e .[all]
-e .[docs]
7 changes: 4 additions & 3 deletions reana_job_controller/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import subprocess
import sys

import paramiko
from reana_db.database import Session
from reana_db.models import Workflow

Expand Down Expand Up @@ -72,6 +71,8 @@ def initialize_krb5_token(workflow_uuid):
class SSHClient:
"""SSH Client."""

import paramiko

def __init__(self, hostname=None, port=None):
"""Initialize ssh client."""
self.hostname = hostname
Expand All @@ -80,8 +81,8 @@ def __init__(self, hostname=None, port=None):

def establish_connection(self):
"""Establish the connection."""
self.ssh_client = paramiko.SSHClient()
self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh_client = self.paramiko.SSHClient()
self.ssh_client.set_missing_host_key_policy(self.paramiko.AutoAddPolicy())
self.ssh_client.connect(hostname=self.hostname, port=self.port, gss_auth=True)

def exec_command(self, command):
Expand Down
7 changes: 7 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is part of REANA.
# Copyright (C) 2020 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

paramiko[gssapi]==2.7.1
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ monotonic==1.5 # via bravado
msgpack-python==0.5.6 # via bravado
msgpack==1.0.0 # via bravado-core
oauthlib==3.1.0 # via requests-oauthlib
paramiko[gssapi]==2.7.1 # via reana-job-controller (setup.py)
paramiko[gssapi]==2.7.1 # via -r requirements.in
psycopg2-binary==2.8.5 # via reana-db
pyasn1-modules==0.2.8 # via google-auth
pyasn1==0.4.8 # via paramiko, pyasn1-modules, rsa
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"sphinxcontrib-redoc>=1.5.1",
],
"tests": tests_require,
"ssh": ["paramiko[gssapi]>=2.6.0"]
}

extras_require["all"] = []
Expand All @@ -54,7 +55,6 @@
"reana-db>=0.7.0a6,<0.8.0",
"htcondor==8.9.7",
"retrying>=1.3.3",
"paramiko[gssapi]>=2.6.0",
]

packages = find_packages()
Expand Down

0 comments on commit 2fa5221

Please sign in to comment.