Skip to main content

Pacifica CLI Tool

Project description

Pacifica CLI Uploader

Build Status Build Status Code Climate Issue Count Docker Stars Docker Pulls Docker Automated build

Python CLI for Pacifica Core Services. This uploader wraps the Pacifica Python Uploader and Pacifica Python Downloader libraries for Windows or Linux command line.

Installation

To install the CLI set up your python environment and then use pip to install.

pip install pacifica-cli

pacifica-cli

This is the main executable program it consists of a main program from pacifica.cli module. Users should be able to access the program from the bin or scripts directories in their python environment.

Configure Sub-Command

The configure subcommand generates a local configuration file for the user. It will read the system configuration to preseed its defaults and asks the user to enter the values required. An example configuration is located here.

The system configuration is processed first and the two directories are, /etc/pacifica-cli/config.ini then PYTHON_PREFIX/pacifica-cli/config.ini. Which ever is found first the client uses that as the system default.

The user configuration is processed second, if found. The directory the client looks in by default is ~/.pacifica-cli/config.ini. The ~ translates to the users home directory on any platform.

System Metadata Configuration

The metadata is managed by a JSON configuration file referenced by an environment variable UPLOADER_CONFIG. By default the environment variable is set to uploader.json. However, it could be managed at a system level or changed on the command line by the --config option.

The contents of the metadata configuration file is complex and should be read from here.

Example Interaction

$ pacifica-cli configure
Generating New Configuration.

Endpoints are an HTTP URL that looks similar to a website but
are designed for an uploader to interact with.

What are the endpoint URLs for the following...

Upload URL (https://ingest.example.com/upload):
Status URL (https://ingest.example.com/get_state):
Policy URL (https://policy.example.com/uploader):

CA certificate bundle is the path to your certificate authority bundle.

Use this if you have a custom site SSL Certificate for your Site.

Valid values:
- True: verify the SSL server certificiate using system bundle
- False: do not verify the SSL server certificate (not recommended)
- a/path/to/a/cacert/bundle: custom path to the server certificate

CA Certificate Bundle (True):

There are three kinds of authentication types supported.

- clientssl - This is where you have an SSL client key and cert
- basic     - This is a username and password
- None      - Do not perform any authentication

Authentication Type (None): basic
Username (None): jdoe
Password (None): password

Upload Sub-Command

There are two sets of options to the upload sub-command. The first comes from the missing values in the metadata configuration json file. The second are common for all uploads and will be documented further.

--follow-links

This will follow symlinked directories as you walk a directory tree building the list of files to upload.

--nowait

The uploader will not wait for the successful or failed ingest of the upload. Instead you will have to query for this information later.

--local-retry

Upload an already generated bundle by the --local-save option. This option will honor the --local-save and --tar-in-tar options as well.

--local-save

The uploader will save off a copy of the uploaded bundle of data. The path is defined as the argument to the option.

--tar-in-tar

A second bundler will be running generating a TAR in a TAR for upload.

--dry-run

Do just the query portion of the upload and print off what the metadata will be set to. This will not upload or generate a local save or retry.

--interactive

Interact with the results of the query engine to manually select the values for each metadata entry requested.

Example Interaction

$ pacifica-cli upload --interactive config.cfg

Instrument ID - Select an ID
=====================================

54 Nittany Liquid Probes - NMR PROBES: Nittany Liquid Probes
104 Transmogriscope - Nanoscale Transmogriscope
Select ID (54): 54

Proposal ID - Select an ID
=====================================

1234a - Pacifica Development (active no close)
1235 - Pacifica Development (no close or end)
1236e - Pacifica Development (expired closed and end)
1237 - Pacifica Development (expired closed no end)
1238 - Pacifica Development (pre-active)
Select ID (1234a): 1234a
Done 10240.
Waiting job to complete (1).
Done.
{
    "created": "2017-09-26 01:32:34",
    "exception": "",
    "job_id": 1,
    "state": "OK",
    "task": "ingest metadata",
    "task_percent": "100.00000",
    "updated": "2017-09-26 01:32:36"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pacifica-cli-0.1.1.tar.gz (24.3 kB view hashes)

Uploaded Source

Built Distributions

pacifica_cli-0.1.1-py3-none-any.whl (15.6 kB view hashes)

Uploaded Python 3

pacifica_cli-0.1.1-py2-none-any.whl (15.6 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page