Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
fixtures
ChangeLog.md
README.md
check.go
main.go
retrieve_data.go
right_pt_suite_test.go
run.go
script.go
script_test.go
update.go
update_test.go
update_unix.go
update_windows.go
upload.go
version_default.go

README.md

fpt

fpt is a command line tool to aid in the development and testing of RightScale Policies. The tool is able to syntax check, upload, and run Policies.

Travis CI Build Status

See ChangeLog.md for changes.

Installation

Since fpt is written in Go it is compiled to a single static binary. Extract and run the executable below:

Configuration

fpt interfaces with the Policy API. Credentials for the API can be provided in two ways:

  1. YAML-based configuration file - Run fpt config account <name>, where name is a nickname for the account, to interactively write the configuration file into $HOME/.fpt.yml for the first time. You will be prompted for the following fields:
    • Account ID - Numeric account number, such as 60073
    • API endpoint host - Hostname, typically governance-3.rightscale.com
    • Refresh Token - Your personal OAuth token available from Settings > Account Settings > API Credentials in the RightScale Cloud Management dashboard
  2. Environment variables - These are meant to be used by build systems such as Travis CI. The following vars must be set: FPT_LOGIN_ACCOUNT_ID, FPT_LOGIN_ACCOUNT_HOST, FPT_LOGIN_ACCOUNT_REFRESH_TOKEN. These variables are equivalent to the ones described in the YAML section above.

Usage

Be sure to read Writing a Custom Policy and check out the brief Tutorial using this tool to develop a simple policy.

The following Policy related commands are supported:

fpt check <file>...
  Check syntax for a Policy Template.

fpt upload <file>...
  Upload Policy Template.

fpt run [<flags>] <file> [<options>...]
  Uploads and applies the PolicyTemplate.

  Execution of the policy will then be followed. Execution log will be tailed and followed and incident printed out.

  Options are user-supplied values for "parameters" defined in the PolicyTemplate language. Options must be in the form of "<name>=<value>". For arrays,
  values must be a comma separated list.

  Example: fpt run max_snapshots.pt regions=us-east-1,us-west-2 max_snapshot_count=100

  -n, --no-log           Do not print policy execution log.
  -k, --keep             Keep applied policy running at end, for inspection in UI. Normally policy is terminated at the end.
  -r, --run-escalations  If set, escalations will be run. Normally dry_run is set to avoid running any escalations.

fpt retrieve_data [<flags>] <file> [<options>...]
  Retrieve data from a Policy Template.

  Executes a policy once and retrieve generated datasources, saving them to disk.

  Example: fpt retrieve_data my_policy.pt --names instances

  -n, --names=NAMES ...      Names of resources/datasources to retrieve. By default, all datasources will be retrieved.
  -o, --output-dir=OUTPUTDIR  Directory to store retrieved datasources.

fpt script [<flags>] <file> [<parameters>...]
  Run the body of a script locally.

  Example: fpt script max_snapshots.pt --result snapshots volumes=@ec2_volumes.json instances=@ec2_instances.json max_count=50

  -o, --out="out.json"  Script output file. Defaults to out.json
  -r, --result=RESULT   Name of variable holding final result to extract. Required if supplying a raw JavaScript.
  -n, --name=NAME       Name of script to run, if multiple exist.

Contributors

This tool is maintained by Douglas Thrift (douglaswth), Peter Schroeter (psschroeter), Avinash Bhashyam (avinashbhashyam-rs)

License

The fpt source code is subject to the MIT license, see the LICENSE file.

You can’t perform that action at this time.