Documentation index

Installation

Requirements

  • Python 3
  • PIP

Dependencies

For version details, please see requirements.txt

  • nipyapi

Install from Source

$ git clone https://github.com/ragerin/nifi-deploy
$ pip3 install -e ./nifi-deploy

Run from source, without installing

Note: Ensure all dependencies are met, refer to the requirements.txt

$ git clone https://github.com/ragerin/nifi-deploy
$ python -m nifi-deploy/nifi_deploy

Usage

nifi-deploy [-v] {export, import} [opts]

Show help

$ nifi-deploy --help
$ nifi-deploy export --help   # Export specific help
$ nifi-deploy import --help   # Import specific help

General parameters

Parameter Alias Description
--version -v Outputs nifi-deploy version and exits without any other action

Export parameters

$ nifi-deploy export <uuid> <name> [-n <hostname>] [-u <username>] [-p <password>] [-d <description>] [-f <filename>] [-q] [-k]
Parameter Alias Description
uuid n/a Required The UUID of a process group located on NIFI_HOST
name n/a Required The name of the exported template (as presented within the Nifi template repository
--nifi_host -n Hostname of the Nifi server, where the /nifi-api/ endpoint is hosted. If not supplied, nifi-deploy will look for the NIFI_HOST environment variable
--username -u Username to authenticate as for the API request. If not supplied, nifi-deploy will look for the NIFI_USERNAME environment variable
--password -p Password for the user. If not supplied, nifi-deploy will first look for the NIFI_PASSWORD environment variable. If not set, nifi-deploy will prompt for the password through the terminal (this requires direct user action)
--description -d A description of the template to show within the Nifi template repository
--filename -f Filename to write the template XML to
--quiet -q Do not output anything, even if --filename is not supplied. Useful for automated tests
--keep_template -k Retain the template in the Nifi template repository, after exporting

Import parameters

$ nifi-deploy import <filename> [-n <hostname>] [-u <username>] [-p <password>]
Parameter Alias Description
filename n/a Template XML file to upload as a template to the Nifi template repository
--nifi_host -n Hostname of the Nifi server, where the /nifi-api/ endpoint is hosted. If not supplied, nifi-deploy will look for the NIFI_HOST environment variable
--username -u Username to authenticate as for the API request. If not supplied, nifi-deploy will look for the NIFI_USERNAME environment variable
--password -p Password for the user. If not supplied, nifi-deploy will first look for the NIFI_PASSWORD environment variable. If not set, nifi-deploy will prompt for the password through the terminal (this requires direct user action)

Environment variables

For improved usability and even some security concerns, it may be beneficial to set the following environment variables, instead of providing them at use-time:

Variable Description
NIFI_HOST Hostname of the Nifi-server, ending with the port-number and optionally /nifi-api/
NIFI_USERNAME Username of the user authenticating with the API
NIFI_PASSWORD If not set and not supplied as an argument parameter, will prompt as non-echoing input

Exporting

Export a process group and output the XML to stdout:

$ nifi-deploy export -n https://nifihost:9090 -u john -p badpractice 0a7361fd-015f-1000-ffff-ffffd2cbc7a7 my_great_template -d template description -f c:\\temp\\my_great_template_export.xml --keep_template

Package API documentation

nifi_deploy package

nifi_deploy.nifi module

Provides a NifiInstance class facilitating easy to use methods utilizing the NiPyApi (https://github.com/Chaffelson/nipyapi) wrapper library.

class nifi_deploy.nifi.NifiInstance(url=None, username=None, password=None, verify_ssl=False)[source]

The NifiInstance class facilitating easy to use methods utilizing the NiPyApi (https://github.com/Chaffelson/nipyapi) wrapper library.

Parameters:
  • url (str) – Nifi host url, defaults to environment variable NIFI_HOST.
  • username (str) – Nifi username, defaults to environment variable NIFI_USERNAME.
  • password (str) – Nifi password, defaults to environment variable NIFI_PASSWORD.
  • verify_ssl (bool) – Whether to verify SSL connection - UNUSED as of now.
create_template(pg_id, name, desc='')[source]

Create a template from process group id.

Parameters:
  • pg_id (str) – Process group ID to create the template from.
  • name (str) – Name of the template to create.
  • desc (str) – Optional, description of the template to create.
Returns:

nipyapi.nifi.TemplateEntity

delete_template(template_id)[source]

Delete a template from Nifi template registry.

Parameters:template_id (str) – ID of the template to delete.
Returns:None
export_template(template_id, file_path=None)[source]

Export a template as XML, and optionally write it to a file or stdout.

Parameters:
  • template_id (str) – ID of the template to export.
  • file_path (str) – Optional, path of file to write the XML to.
Returns:

String (template xml)

import_template(file_path)[source]

Imports a template XML into Nifi’s template store.

Parameters:file_path (str) – Path of the XML file to import into Nifi as a template.
Returns:None

nifi_deploy.nifi_deploy module

This file is used for the CLI tool. By default setup.py links nifi-deploy as an executable to this file.

nifi_deploy.nifi_deploy.cli()[source]
nifi_deploy.nifi_deploy.export_function(args)[source]
nifi_deploy.nifi_deploy.import_function(args)[source]

License

MIT License

Copyright (c) 2018 Mads H. Jakobsen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Indices and tables