Skip to content

Commit

Permalink
Merge pull request #265 from RedProkofiev/nick-dev-breaking-brokers
Browse files Browse the repository at this point in the history
Remove LDAP that was deprecated previously
  • Loading branch information
tofu-rocketry authored Sep 9, 2024
2 parents 762212a + 985d58d commit 0539eb6
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 363 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Set up dependencies for python-ldap
run: sudo apt-get install libsasl2-dev libldap2-dev libssl-dev

- name: Base requirements for SSM
run: pip install -r requirements.txt

Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ RUN yum -y install epel-release && yum clean all
# Then get pip
RUN yum -y install python3-pip && yum clean all

# Install the system requirements of python-ldap
RUN yum -y install gcc python3-devel openldap-devel && yum clean all

# Install libffi, a requirement of openssl
RUN yum -y install libffi-devel && yum clean all

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ The Python STOMP library (N.B. versions between 3.1.1 (inclusive) and 5.0.0

The Python AMS library. This is only required if you want to use AMS. See here for details on obtaining an RPM: https://github.com/ARGOeu/argo-ams-library/

The Python ldap library (N.B. versions before 3.4.0 (exclusive) are currently supported)
* `yum install python-ldap`

Optionally, the Python dirq library (N.B. this is only required if your messages
are stored in a dirq structure)
* `yum install python-dirq`
Expand Down Expand Up @@ -239,7 +236,6 @@ add your messages using the `add` method.

* `yum remove stomppy`
* `yum remove python-daemon`
* `yum remove python-ldap`

* `rm -rf /var/spool/apel`
* `rm -rf /var/log/apel`
Expand Down
2 changes: 1 addition & 1 deletion apel-ssm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BuildArch: noarch
BuildRequires: python-devel
%endif

Requires: stomppy < 5.0.0, python-ldap < 3.4.0, python-setuptools, openssl
Requires: stomppy < 5.0.0, python-setuptools, openssl
Requires(pre): shadow-utils

%define ssmconf %_sysconfdir/apel
Expand Down
12 changes: 3 additions & 9 deletions conf/receiver.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
protocol: AMS

[broker]

# The SSM will query a BDII to find brokers available. These details are for the
# EGI production broker network
#bdii: ldap://lcg-bdii.cern.ch:2170
#network: PROD
# Alternatively, 'host' and 'port' can be set manually (with 'bdii' and
# 'network' commented out). The 'host' option MUST be used for AMS.
# 'host' and 'port' must be set manually as LDAP broker search is now removed.
# 'port' is not used with AMS.
host: msg-devel.argo.grnet.gr
#host: msg.argo.grnet.gr
#port:
# port: 443

# broker authentication. If use_ssl is set, the certificates configured
# in the mandatory [certificates] section will be used.
Expand Down
12 changes: 3 additions & 9 deletions conf/sender.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
protocol: AMS

[broker]

# The SSM will query a BDII to find brokers available. These details are for the
# EGI production broker network
#bdii: ldap://lcg-bdii.cern.ch:2170
#network: PROD
# Alternatively, 'host' and 'port' can be set manually (with 'bdii' and
# 'network' commented out). The 'host' option MUST be used for AMS.
# 'host' and 'port' must be set manually as LDAP broker search is now removed.
# 'port' is not used with AMS.
host: msg-devel.argo.grnet.gr
#host: msg.argo.grnet.gr
#port:
# port: 443

# broker authentication. If use_ssl is set, the certificates configured
# in the mandatory [certificates] section will be used.
Expand Down
3 changes: 1 addition & 2 deletions requirements-docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ pyopenssl
cryptography
stomp.py
python-daemon
python-ldap
setuptools # Required for pkg_resources (also happens to be a dependency of python-ldap)
setuptools # Required for pkg_resources

# Dependencies for optional dirq based sending
dirq
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ pyopenssl >=19.1.0, <=21.0.0 # 22.0.0 dropped support for Python 2
cryptography==3.3.2 # Crypto dropped support for Python 2 after 3.3
stomp.py<5.0.0
python-daemon<=2.3.0 # 2.3.1 dropped support for Python 2
python-ldap<3.4.0 # python-ldap-3.4.0 dropped support for Python 2
setuptools # Required for pkg_resources (also happens to be a dependency of python-ldap)
setuptools # Required for pkg_resources

# Dependencies for optional dirq based sending
dirq
3 changes: 0 additions & 3 deletions scripts/ssm-build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ fpm -s python -t deb \
--depends python2.7 \
--depends python-pip \
--depends 'python-stomp < 5.0.0' \
--depends python-ldap \
--depends libssl-dev \
--depends libsasl2-dev \
--depends openssl \
--deb-changelog $SOURCE_DIR/ssm-$TAG/CHANGELOG \
--python-install-bin /usr/bin \
Expand Down
8 changes: 0 additions & 8 deletions scripts/ssm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ if [[ ${PY_NUM:0:1} == "3" ]]; then
--depends python3-openssl \
--depends python3-daemon \
--depends 'python3-stomp' \
--depends python3-ldap \
--depends libssl-dev \
--depends libsasl2-dev \
--depends openssl "

# Currently builds for el8
Expand All @@ -149,7 +146,6 @@ if [[ ${PY_NUM:0:1} == "3" ]]; then
--depends python3-cryptography \
--depends python3-pyOpenSSL \
--depends python3-daemon \
--depends python3-ldap \
--depends openssl \
--depends openssl-devel "
fi
Expand All @@ -161,12 +157,9 @@ elif [[ ${PY_NUM:0:1} == "2" ]]; then
FPM_PYTHON="--depends python2.7 \
--depends python-pip \
--depends 'python-stomp < 5.0.0' \
--depends python-ldap \
--depends python-cryptography \
--depends python-openssl \
--depends python-daemon \
--depends libssl-dev \
--depends libsasl2-dev \
--depends openssl "

# el7 and below, due to yum package versions
Expand All @@ -177,7 +170,6 @@ elif [[ ${PY_NUM:0:1} == "2" ]]; then
--depends python2-pyOpenSSL \
--depends python2-daemon \
--depends stomppy \
--depends python-ldap \
--depends openssl \
--depends openssl-devel "
fi
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def main():
install_requires=[
'cryptography',
'stomp.py',
'python-ldap',
'setuptools',
'pyopenssl',
],
Expand Down
36 changes: 6 additions & 30 deletions ssm/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import ldap
import sys
import time

Expand Down Expand Up @@ -49,7 +48,6 @@ class AmsConnectionException(Exception):
from ssm import set_up_logging, LOG_BREAK
from ssm.ssm2 import Ssm2, Ssm2Exception
from ssm.crypto import CryptoException, get_certificate_subject, _from_file
from ssm.brokers import StompBrokerGetter, STOMP_SERVICE, STOMP_SSL_SERVICE

# How often (in seconds) to read the list of valid DNs.
REFRESH_DNS = 600
Expand Down Expand Up @@ -104,35 +102,13 @@ def get_ssm_args(protocol, cp, log):
project = None
token = ''

use_ssl = cp.getboolean('broker', 'use_ssl')
if use_ssl:
service = STOMP_SSL_SERVICE
else:
service = STOMP_SERVICE

# If we can't get a broker to connect to, we have to give up.
try:
bdii_url = cp.get('broker', 'bdii')
log.info('Retrieving broker details from %s ...', bdii_url)
bg = StompBrokerGetter(bdii_url)
brokers = bg.get_broker_hosts_and_ports(service, cp.get('broker',
'network'))
log.info('Found %s brokers.', len(brokers))
except ConfigParser.NoOptionError as e:
try:
host = cp.get('broker', 'host')
port = cp.get('broker', 'port')
brokers = [(host, int(port))]
except ConfigParser.NoOptionError:
log.error('Options incorrectly supplied for either single '
'broker or broker network. '
'Please check configuration')
log.error('System will exit.')
log.info(LOG_BREAK)
print('SSM failed to start. See log file for details.')
sys.exit(1)
except ldap.LDAPError as e:
log.error('Could not connect to LDAP server: %s', e)
host = cp.get('broker', 'host')
port = cp.get('broker', 'port')
brokers = [(host, int(port))]
except ConfigParser.NoOptionError:
log.error('Host options incorrectly supplied for message broker '
'or AMS endpoint. Please check configuration.')
log.error('System will exit.')
log.info(LOG_BREAK)
print('SSM failed to start. See log file for details.')
Expand Down
157 changes: 0 additions & 157 deletions ssm/brokers.py

This file was deleted.

Loading

0 comments on commit 0539eb6

Please sign in to comment.