From 208f2cfe866756e3aff550a865d3094565d1282e Mon Sep 17 00:00:00 2001 From: Matthew Watkins Date: Mon, 12 Feb 2024 10:59:24 +0000 Subject: [PATCH] Chore: Update openstacksdk from <1.5.0 to >=2.1.0 Also, updated linting tool versions with pre-commit autoupdate. Addressed minor type checking issue flagged by flake8. Minor file formatting changes implemented via linting. Issue: IT-26453 Change-Id: If9f941326c3f105d71fd0014d900653633d886ea Signed-off-by: Matthew Watkins --- .pre-commit-config.yaml | 10 +++++----- lftools/cli/ldap_cli.py | 2 +- lftools/jenkins/token.py | 6 ++++-- pyproject.toml | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 673a9e36..75fda318 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: ########### - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace @@ -19,23 +19,23 @@ repos: ########## - repo: https://github.com/ambv/black - rev: 23.3.0 + rev: 24.1.1 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 args: ["--max-line-length=120"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.2.0 + rev: v1.8.0 hooks: - id: mypy additional_dependencies: diff --git a/lftools/cli/ldap_cli.py b/lftools/cli/ldap_cli.py index 241cbdfe..ef356ead 100644 --- a/lftools/cli/ldap_cli.py +++ b/lftools/cli/ldap_cli.py @@ -102,7 +102,7 @@ def csv(ctx, ldap_server, ldap_group_base, ldap_user_base, groups): ldap_object.protocol_version = ldap.VERSION3 ldap_object.simple_bind_s() except ldap.LDAPError as e: - if type(e.message) == dict and "desc" in e.message: + if type(e.message) is dict and "desc" in e.message: print(e.message["desc"]) else: print(e) diff --git a/lftools/jenkins/token.py b/lftools/jenkins/token.py index 361dce36..8dee209d 100644 --- a/lftools/jenkins/token.py +++ b/lftools/jenkins/token.py @@ -33,7 +33,8 @@ def get_token(name: str, url: str, username: str, password: str, change: bool = server: jenkins.Jenkins = jenkins.Jenkins(url, username=username, password=password) # type: ignore - get_token: str = """ + get_token: str = ( + """ import hudson.model.* import jenkins.model.* import jenkins.security.* @@ -43,7 +44,8 @@ ApiTokenProperty t = u.getProperty(ApiTokenProperty.class) def token = t.tokenStore.generateNewToken("{}") println token.plainValue """.format( - username, name + username, name + ) ) token: str = str(server.run_script(get_token)) diff --git a/pyproject.toml b/pyproject.toml index dd05ad6b..8874f790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ dependencies = [ "multi-key-dict", "nodeenv", "oauth2client", - "openstacksdk<1.5.0", + "openstacksdk>=2.1.0", "pbr", "pyasn1", "pyasn1-modules", -- 2.16.6