.gitreview,
.gitmodules,
.pytest_cache/**,
- node_modules/**
+ node_modules/**,
+ docs/conf.py,
+ lftools/cli/nexus2/**,
+ lftools/cli/nexus3/**,
+ .venv/**
[all.Documentation]
bears = WriteGoodLintBear
PyFlakesBear,
PyImportSortBear
files = lftools/**.py
-ignore += docs/conf.py
-ignore += lftools/cli/nexus3/*.py
known_first_party_imports = lftools
known_third_party_imports =
defusedxml,
lfidapi
license
nexus
+ nexus2
nexus3
openstack
rtd
--- /dev/null
+.. _nexus2:
+
+******
+Nexus3
+******
+
+.. program-output:: lftools nexus2 --help
+
+.. _nexus2_commands:
+
+Commands
+========
+
+.. contents:: Nexus2 Commands
+ :local:
+
+.. _nexus2_privileges:
+
+privilege
+---------
+
+.. program-output:: lftools nexus2 privilege --help
+
+.. _nexus2_repository:
+
+repository
+----------
+
+.. program-output:: lftools nexus2 repository --help
+
+.. _nexus2_role:
+
+role
+----
+
+.. program-output:: lftools nexus2 role --help
+
+.. _nexus2_user:
+
+user
+----
+
+.. program-output:: lftools nexus2 user --help
self.password = self.creds["password"]
self.r = requests.Session()
self.r.auth = (self.username, self.password)
- self.r.headers.update(
- {"Content-Type": "application/json; charset=UTF-8"}
- )
+ self.r.headers.update({
+ "Content-Type": "application/json; charset=UTF-8",
+ "Accept": "application/json"
+ })
if self.creds["authtype"] == "token":
self.token = self.creds["token"]
def _request(self, url, method, data=None, timeout=30):
"""Execute the request."""
- resp = self.r.request(
- method, self.endpoint + url, data=data, timeout=timeout
- )
+ resp = self.r.request(method,
+ self.endpoint + url,
+ data=data,
+ timeout=timeout)
# Some massaging to make our gerrit python code work
if resp.status_code == 409:
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API interface."""
+
+__author__ = 'DW Talton'
+
+import json
+import logging
+
+from lftools import config
+import lftools.api.client as client
+
+log = logging.getLogger(__name__)
+
+
+class Nexus2(client.RestApi):
+ """API endpoint wrapper for Nexus2."""
+
+ def __init__(self, **params):
+ """Initialize the class."""
+ self.params = params
+ self.fqdn = self.params["fqdn"]
+ if "creds" not in self.params:
+ creds = {
+ "authtype": "basic",
+ "username": config.get_setting(self.fqdn, "username"),
+ "password": config.get_setting(self.fqdn, "password"),
+ "endpoint": config.get_setting(self.fqdn, "endpoint"),
+ }
+ params["creds"] = creds
+
+ super(Nexus2, self).__init__(**params)
+
+############
+# Privileges
+ def privilege_list(self):
+ """List privileges."""
+ result = self.get('service/local/privileges')[1]['data']
+
+ privilege_list = []
+ for privilege in result:
+ privilege_list.append([
+ privilege['name'],
+ privilege['id']
+ ])
+
+ privilege_list.sort()
+ return privilege_list
+
+ def privilege_create(self, name, description, repo):
+ """Create a new privilege.
+
+ :param name: the privilege name
+ :param description: the privilege description
+ :param repo: the repo to attach to the privilege
+ """
+ data = {
+ 'data': {
+ 'name': name,
+ 'description': description,
+ 'type': 'target',
+ 'repositoryTargetId': 'any',
+ 'repositoryId': repo,
+ 'repositoryGroupId': '',
+ 'method': ['create', 'read', 'update', 'delete']
+ }
+ }
+
+ json_data = json.dumps(data)
+ result = self.post('service/local/privileges_target', data=json_data)
+
+ if result[0].status_code == 201:
+ return 'Privilege successfully created.'
+
+ def privilege_delete(self, privilege_id):
+ """Delete a privilege.
+
+ :param privilege_id: the ID of the privilege (from privilege list)
+ """
+ result = self.delete('service/local/privileges/{}'.format(privilege_id))
+
+ if result.status_code == 204:
+ return "Privilege successfully deleted."
+
+##############
+# Repositories
+ def repo_list(self):
+ """Get a list of repositories."""
+ result = self.get('service/local/repositories')[1]['data']
+
+ repo_list = []
+ for repo in result:
+ repo_list.append([
+ repo['name'],
+ repo['repoType'],
+ repo['provider'],
+ repo['id']
+ ])
+
+ return repo_list
+
+ def repo_create(self, repo_type, repo_id, repo_name, repo_provider, repo_policy, repo_upstream_url):
+ """Add a new repo.
+
+ :param repo_type: the type of repo. Valid types are 'proxy' and 'hosted'
+ :param repo_id: the ID for the repository
+ :param repo_name: the name for the repository
+ :param repo_provider: the provider type. Valid types are 'maven2' and 'site'
+ :param repo_policy: the repo policy. Valid types are 'RELEASE', 'SNAPSHOT', 'MIXED'
+ :param repo_upstream_url: the URL to an upstream repo when creating a proxy repo
+ """
+ # common data regardless of repo type
+ data = {
+ "data": {
+ "browseable": True,
+ "exposed": True,
+ "id": repo_id,
+ "indexable": True,
+ "name": repo_name,
+ "notFoundCacheTTL": 1440,
+ "provider": repo_provider,
+ "providerRole": "org.sonatype.nexus.proxy.repository.Repository",
+ "repoPolicy": repo_policy,
+ 'repoType': repo_type
+ }
+ }
+
+ if repo_type == "hosted":
+ data['data'].update({
+ "checksumPolicy": "IGNORE",
+ "downloadRemoteIndexes": False,
+ "writePolicy": "ALLOW_WRITE_ONCE"
+ })
+ if repo_provider == 'site':
+ data['data'].update({
+ 'repoPolicy': 'MIXED',
+ 'writePolicy': 'ALLOW_WRITE',
+ 'indexable': False,
+ })
+
+ if repo_type == 'proxy':
+ data['data'].update({
+ 'artifactMaxAge': -1,
+ 'autoBlockActive': True,
+ "checksumPolicy": "WARN",
+ "downloadRemoteIndexes": True,
+ 'fileTypeValidation': True,
+ 'metadataMaxAge': 1440,
+ 'remoteStorage': {
+ 'authentication': None,
+ 'connectionSettings': None,
+ 'remoteStorageUrl': repo_upstream_url
+ }
+ })
+
+ json_data = json.dumps(data)
+ result = self.post("service/local/repositories", data=json_data)
+
+ if result[0].status_code == 201:
+ return "Repo successfully created."
+ else:
+ return "Failed to create new repository"
+
+ def repo_delete(self, repo_id):
+ """Permanently delete a repo.
+
+ :param repo_id: the ID of the repo from repo list.
+ """
+ result = self.delete('service/local/repositories/{}'.format(repo_id))
+
+ if result.status_code == 204:
+ return "Repo successfully deleted."
+ else:
+ exit(1)
+
+#######
+# Roles
+ def role_list(self):
+ """List all roles."""
+ result = self.get('service/local/roles')[1]
+
+ role_list = []
+ for role in result['data']:
+
+ # wacky string concat is to provide the right format
+ # so that tabulate will iterate the string at the newline
+ # breaks and show multiline columns in a nice way
+ roles_string = ''
+ privs_string = ''
+ if 'roles' in role:
+ for roles in role['roles']:
+ roles_string += roles + '\n'
+
+ if 'privileges' in role:
+ for privs in role['privileges']:
+ privs_string += privs + '\n'
+
+ role_list.append([
+ role['id'],
+ role['name'],
+ roles_string,
+ privs_string
+ ])
+
+ return role_list
+
+ def role_create(self, role_id, role_name, role_description, roles_list=None, privs_list=None):
+ """Create a new role.
+
+ :param role_id: the ID name of the role (string)
+ :param role_name: the actual name of the role
+ :param role_description: the description of the role
+ :param roles_list: (optional) a list of existing roles to attach to this role
+ :param privs_list: (optional) a list of existing privs to attach to this role
+ """
+ data = {
+ 'data': {
+ 'id': role_id,
+ 'name': role_name,
+ 'description': role_description,
+ 'sessionTimeout': 0,
+ 'userManaged': True
+ }
+ }
+
+ if roles_list:
+ data['data']['roles'] = roles_list.split(',')
+
+ if privs_list:
+ data['data']['privileges'] = privs_list.split(',')
+
+ json_data = json.dumps(data)
+ result = self.post('service/local/roles', data=json_data)
+
+ if result[0].status_code == 201:
+ return "Role successfully created."
+
+ return result
+
+ def role_delete(self, role_id):
+ """Permanently delete a role.
+
+ :param role_id: The ID of the role to delete (from role list)
+ """
+ result = self.delete('service/local/roles/{}'.format(role_id))
+
+ if result.status_code == 204:
+ return "Role successfully deleted."
+
+#######
+# Users
+ def user_list(self):
+ """List all users."""
+ result = self.get('service/local/plexus_users/allConfigured')[1]['data']
+ user_list = []
+ for user in result:
+ role_list = []
+ for role in user['roles']:
+ role_list.append([
+ role['roleId']
+ ])
+
+ user_list.append([
+ user['userId'],
+ user['firstName'],
+ user['lastName'],
+ user['status'],
+ role_list
+ ])
+
+ return user_list
+
+ def user_create(self, username, firstname, lastname, email, roles):
+ """Add a new user.
+
+ :param username: the username
+ :param firstname: the user's first name
+ :param lastname: the user's last name
+ :param email: the user's email address
+ :param roles: a comma-separated list of roles to add the user to
+ """
+ role_list = roles.split(',')
+ data = {
+ 'data': {
+ 'userId': username,
+ 'firstName': firstname,
+ 'lastName': lastname,
+ 'status': 'active',
+ 'email': email,
+ 'roles': role_list
+ }
+ }
+
+ json_data = json.dumps(data)
+ result = self.post('service/local/users', data=json_data)
+
+ if result[0].status_code == 201:
+ return "User successfully created."
+ else:
+ return "Failed to create new user"
+
+ def user_delete(self, username):
+ """Permanently delete a user.
+
+ :param username: The username to delete (from user list)
+ """
+ result = self.delete('service/local/users/{}'.format(username))
+
+ if result.status_code == 204:
+ return "User successfully deleted."
##############################################################################
"""Nexus3 REST API interface."""
+
+__author__ = 'DW Talton'
+
import json
import logging
log = logging.getLogger(__name__)
-class Nexus(client.RestApi):
+class Nexus3(client.RestApi):
"""API endpoint wrapper for Nexus3."""
def __init__(self, **params):
}
params["creds"] = creds
- super(Nexus, self).__init__(**params)
+ super(Nexus3, self).__init__(**params)
def create_role(self, name, description, privileges, roles):
"""Create a new role.
"""Read the Docs REST API interface."""
+__author__ = 'DW Talton'
+
import json
from lftools import config
##############################################################################
"""CLI main for lftools."""
-__author__ = 'Thanh Ha'
import configparser
import getpass
from lftools.cli.jenkins import jenkins_cli
from lftools.cli.lfidapi import lfidapi
from lftools.cli.license import license
-from lftools.cli.nexus3 import nexus3
+from lftools.cli.nexus2 import nexus_two
+from lftools.cli.nexus3 import nexus_three
from lftools.cli.nexus import nexus
from lftools.cli.rtd import rtd
from lftools.cli.schema import schema
cli.add_command(jenkins_cli, name='jenkins')
cli.add_command(license)
cli.add_command(nexus)
-cli.add_command(nexus3)
+cli.add_command(nexus_two)
+cli.add_command(nexus_three)
cli.add_command(rtd)
cli.add_command(schema)
cli.add_command(lfidapi)
##############################################################################
"""Script to check a git repository for commits missing DCO."""
+__author__ = 'DW Talton'
+
import sys
import click
@click.group()
@click.pass_context
def nexus(ctx):
- """Provide an interface to Nexus."""
+ """(Deprecated) Use the Nexus2 API Interface.
+
+ Provide an interface to Nexus.
+ """
pass
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API sub-interfaces."""
+
+__author__ = 'DW Talton'
+
+
+from lftools.api.endpoints import nexus2
+
+from .privilege import *
+from .repository import *
+from .role import *
+from .user import *
+
+
+@click.group(name="nexus2")
+@click.argument('fqdn')
+@click.pass_context
+def nexus_two(ctx, fqdn):
+ """The Nexus2 API Interface."""
+ nexus2_obj = nexus2.Nexus2(fqdn=fqdn)
+ ctx.obj = {"nexus2": nexus2_obj}
+ pass
+
+
+nexus_two.add_command(privilege)
+nexus_two.add_command(repo)
+nexus_two.add_command(role)
+nexus_two.add_command(user)
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API user interface."""
+
+__author__ = 'DW Talton'
+
+import logging
+
+import click
+from tabulate import tabulate
+
+log = logging.getLogger(__name__)
+
+
+@click.group()
+@click.pass_context
+def privilege(ctx):
+ """User primary interface."""
+ pass
+
+
+@privilege.command(name="list")
+@click.pass_context
+def list(ctx):
+ """List privileges."""
+ r = ctx.obj["nexus2"]
+ data = r.privilege_list()
+ log.info(
+ tabulate(
+ data,
+ headers=[
+ "Name",
+ "ID"
+ ]
+ ))
+
+
+@privilege.command(name="create")
+@click.argument("name")
+@click.argument("description")
+@click.argument("repo")
+@click.pass_context
+def create(ctx, name, description, repo):
+ """Create a new privilege."""
+ r = ctx.obj["nexus2"]
+ data = r.privilege_create(name, description, repo)
+ log.info(data)
+
+
+@privilege.command(name="delete")
+@click.argument("privilege_id")
+@click.pass_context
+def delete(ctx, privilege_id):
+ """Delete a privilege."""
+ r = ctx.obj["nexus2"]
+ data = r.privilege_delete(privilege_id)
+ log.info(data)
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API repository interface."""
+
+__author__ = 'DW Talton'
+
+import logging
+
+import click
+from tabulate import tabulate
+
+log = logging.getLogger(__name__)
+
+
+@click.group()
+@click.pass_context
+def repo(ctx):
+ """Repository primary interface."""
+ pass
+
+
+@repo.command(name="list")
+@click.pass_context
+def repo_list(ctx):
+ """List repositories."""
+ r = ctx.obj["nexus2"]
+ data = r.repo_list()
+ log.info(
+ tabulate(
+ data,
+ headers=[
+ "Name",
+ "Type",
+ "Provider",
+ "ID"
+ ]
+ ))
+
+
+@repo.command(name="create")
+@click.argument("repo_type")
+@click.argument("repo_id")
+@click.argument("repo_name")
+@click.argument("repo_provider")
+@click.argument("repo_policy")
+@click.option('-u', '--upstream-repo', 'repo_upstream_url')
+@click.pass_context
+def create(ctx, repo_type, repo_id, repo_name, repo_provider, repo_policy, repo_upstream_url):
+ """Create a new repository."""
+ r = ctx.obj["nexus2"]
+ data = r.repo_create(repo_type, repo_id, repo_name, repo_provider, repo_policy, repo_upstream_url)
+ log.info(data)
+
+
+@repo.command(name="delete")
+@click.argument("repo_id")
+@click.pass_context
+def delete(ctx, repo_id):
+ """Permanently delete a repo."""
+ r = ctx.obj["nexus2"]
+ data = r.repo_delete(repo_id)
+ log.info(data)
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API user interface."""
+
+__author__ = 'DW Talton'
+
+import logging
+
+import click
+from tabulate import tabulate
+
+log = logging.getLogger(__name__)
+
+
+@click.group()
+@click.pass_context
+def role(ctx):
+ """User primary interface."""
+ pass
+
+
+@role.command(name="list")
+@click.pass_context
+def role_list(ctx):
+ """List users."""
+ r = ctx.obj["nexus2"]
+ data = r.role_list()
+ log.info(
+ tabulate(
+ data,
+ headers=[
+ "ID",
+ "Name",
+ "Roles",
+ "Privileges"
+ ],
+ tablefmt="grid"
+ ))
+
+
+@role.command(name="create")
+@click.argument("role_id")
+@click.argument("role_name")
+@click.option('-d', "role_description", required=False)
+@click.option('-r', "roles_list", required=False)
+@click.option('-p', "privileges_list", required=False)
+@click.pass_context
+def role_create(ctx, role_id, role_name, role_description, roles_list, privileges_list):
+ """Create a new role."""
+ r = ctx.obj["nexus2"]
+ data = r.role_create(role_id, role_name, role_description, roles_list, privileges_list)
+ log.info(data)
+
+
+@role.command(name="delete")
+@click.argument("role_id")
+@click.pass_context
+def role_delete(ctx, role_id):
+ """Delete a role."""
+ r = ctx.obj["nexus2"]
+ data = r.role_delete(role_id)
+ log.info(data)
--- /dev/null
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+"""Nexus2 REST API user interface."""
+
+__author__ = 'DW Talton'
+
+import logging
+
+import click
+from tabulate import tabulate
+
+log = logging.getLogger(__name__)
+
+
+@click.group()
+@click.pass_context
+def user(ctx):
+ """User primary interface."""
+ pass
+
+
+@user.command(name="list")
+@click.pass_context
+def user_list(ctx):
+ """List users."""
+ r = ctx.obj["nexus2"]
+ data = r.user_list()
+ log.info(
+ tabulate(
+ data,
+ headers=[
+ "ID",
+ "First Name",
+ "Last Name",
+ "Status",
+ "Roles"
+ ]
+ ))
+
+
+@user.command(name="add")
+@click.argument("username")
+@click.argument("firstname")
+@click.argument("lastname")
+@click.argument("email")
+@click.argument("roles")
+@click.pass_context
+def user_create(ctx, username, firstname, lastname, email, roles):
+ """Add a new user."""
+ r = ctx.obj["nexus2"]
+ data = r.user_create(username, firstname, lastname, email, roles)
+ log.info(data)
+
+
+@user.command(name="delete")
+@click.argument("username")
+@click.pass_context
+def user_details(ctx, username):
+ """Delete a user."""
+ r = ctx.obj["nexus2"]
+ data = r.user_delete(username)
+ log.info(data)
"""Nexus3 REST API sub-interfaces."""
+__author__ = 'DW Talton'
+
from .asset import *
from .privilege import *
from .repository import *
from .user import *
-@click.group()
+@click.group(name="nexus3")
@click.argument("fqdn")
@click.pass_context
-def nexus3(ctx, fqdn):
- """Provide an interface to Nexus3."""
- nexus_obj = nexus.Nexus(fqdn=fqdn)
- ctx.obj = {"nexus": nexus_obj}
+def nexus_three(ctx, fqdn):
+ """The Nexus3 API Interface."""
+ nexus3_obj = nexus3.Nexus3(fqdn=fqdn)
+ ctx.obj = {"nexus3": nexus3_obj}
pass
-nexus3.add_command(asset)
-nexus3.add_command(privilege)
-nexus3.add_command(repository)
-nexus3.add_command(role)
-nexus3.add_command(script)
-nexus3.add_command(tag)
-nexus3.add_command(task)
-nexus3.add_command(user)
+nexus_three.add_command(asset)
+nexus_three.add_command(privilege)
+nexus_three.add_command(repository)
+nexus_three.add_command(role)
+nexus_three.add_command(script)
+nexus_three.add_command(tag)
+nexus_three.add_command(task)
+nexus_three.add_command(user)
"""Nexus3 REST API asset interface."""
+__author__ = 'DW Talton'
+
import logging
from pprint import pformat
import click
-from lftools.api.endpoints import nexus
+from lftools.api.endpoints import nexus3
log = logging.getLogger(__name__)
@click.pass_context
def asset_list(ctx, repository):
"""List assets."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_assets(repository)
for item in data:
log.info(pformat(item))
@click.pass_context
def asset_search(ctx, query_string, repository, details):
"""Search assets."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.search_asset(query_string, repository, details)
if details:
"""Nexus3 REST API privileges interface."""
+__author__ = 'DW Talton'
+
import logging
import click
@click.pass_context
def list_privileges(ctx):
"""List privileges."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_privileges()
log.info(
tabulate(data, headers=["Type", "Name", "Description", "Read Only"])
"""Nexus3 REST API repository interface."""
+__author__ = 'DW Talton'
+
import logging
from pprint import pformat
import click
-from lftools.api.endpoints import nexus # noqa: F401
+from lftools.api.endpoints import nexus3 # noqa: F401
log = logging.getLogger(__name__)
@click.pass_context
def list_repositories(ctx):
"""List repositories."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_repositories()
log.info(pformat(data))
"""Nexus3 REST API role interface."""
+__author__ = 'DW Talton'
+
import logging
from pprint import pformat
import click
from tabulate import tabulate
-from lftools.api.endpoints import nexus # noqa: F401
+from lftools.api.endpoints import nexus3 # noqa: F401
log = logging.getLogger(__name__)
@click.pass_context
def list_roles(ctx):
"""List roles."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_roles()
log.info(tabulate(data, headers=["Roles"]))
@click.pass_context
def create_role(ctx, name, description, privileges, roles):
"""Create roles."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.create_role(name, description, privileges, roles)
log.info(pformat(data))
"""Nexus3 REST API script interface."""
+__author__ = 'DW Talton'
+
import logging
import click
-from lftools.api.endpoints import nexus # noqa: F401
+from lftools.api.endpoints import nexus3 # noqa: F401
log = logging.getLogger(__name__)
@click.pass_context
def create_script(ctx, name, filename):
"""Create a new script."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.create_script(name, filename)
log.info(data)
@click.pass_context
def delete_script(ctx, name):
"""Delete a script."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.delete_script(name)
log.info(data)
@click.pass_context
def list_scripts(ctx):
"""List all scripts."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_scripts()
log.info(data)
@click.pass_context
def read_script(ctx, name):
"""Get script contents."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.read_script(name)
log.info(data)
@click.pass_context
def run_script(ctx, name):
"""Run a script."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.run_script(name)
log.info(data)
@click.pass_context
def update_script(ctx, name, content):
"""Update script contents."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.update_script(name, content)
log.info(data)
"""Nexus3 REST API tag interface."""
+__author__ = 'DW Talton'
+
import logging
from pprint import pformat
@click.pass_context
def add_tag(ctx, name, attributes):
"""Add a tag."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.create_tag(name, attributes)
log.info(pformat(data))
@click.pass_context
def delete_tag(ctx, name):
"""Delete a tag."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.delete_tag(name)
log.info(pformat(data))
@click.pass_context
def list_tags(ctx):
"""List tags."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_tags()
log.info(pformat(data))
@click.pass_context
def show_tag(ctx, name):
"""Show tags."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.show_tag(name)
log.info(pformat(data))
##############################################################################
"""Nexus3 REST API task interface."""
+
+__author__ = 'DW Talton'
+
import logging
import click
from tabulate import tabulate
-from lftools.api.endpoints import nexus # noqa: F401
+from lftools.api.endpoints import nexus3 # noqa: F401
log = logging.getLogger(__name__)
@click.pass_context
def list_tasks(ctx):
"""List tasks."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_tasks()
log.info(
tabulate(
"""Nexus3 REST API user interface."""
+__author__ = 'DW Talton'
+
import logging
import click
from tabulate import tabulate
-from lftools.api.endpoints import nexus # noqa: F401
+from lftools.api.endpoints import nexus3 # noqa: F401
log = logging.getLogger(__name__)
@click.pass_context
def search_user(ctx, username):
"""Search users."""
- r = ctx.obj["nexus"]
+ r = ctx.obj["nexus3"]
data = r.list_user(username)
log.info(
tabulate(
"""Read the Docs interface."""
+__author__ = 'DW Talton'
+
import logging
from pprint import pformat
##############################################################################
"""Functions for DCO check tasks."""
+__author__ = 'DW Talton'
+
import logging
from os import chdir
from os import getcwd
--- /dev/null
+---
+features:
+ - |
+ Nexus2 API operations.
+
+ Usage: lftools nexus2 [OPTIONS] COMMAND [ARGS]...
+
+ .. code-block:: none
+
+ Commands:
+ privilege Privilege primary interface.
+ repository Repository primary interface.
+ role Role primary interface.
+ user User primary interface.
+
+ .. code-block:: none
+
+ Options:
+ --help Show this message and exit.
pre-commit,
py35,
py36,
- py37
+ py37,
+ py38
skip_missing_interpreters = true
[testenv]