Skip to content

Commit

Permalink
Merge pull request #15 from rightscale/fpt_credentials_short_flag_C
Browse files Browse the repository at this point in the history
Add short flag ("-C") for credentials to along with --credentials
  • Loading branch information
douglaswth authored Feb 28, 2020
2 parents de8a43d + e037b19 commit b12767c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
25 changes: 13 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ matrix:
include:
- os: linux
env: MAKE=make
# Windows builds broken on travis: https://travis-ci.community/t/choco-install-hangs-forever/307/23.
# git revert a1f9a47623910f77a52c31fa8614db6819ac04cb to build/test/deploy from each os (windows/darwin/linux) when this is fixed
- os: osx
osx_image: xcode11.3
env: MAKE=make
- os: windows
env: MAKE=mingw32-make
cache:
directories:
- $HOME/.cache/go-build
Expand All @@ -16,23 +19,21 @@ addons:
packages:
# install 7z on Linux so both the Linux and Windows build can make the zip file the same way
- p7zip-full
homebrew:
packages:
# install modern bash and coreutils on macOS so that version.sh script works correctly
- bash
- coreutils
update: true
before_install:
# install latest mercurial client on Linux. Older clients have issues https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01
- if [[ $TRAVIS_OS_NAME == linux ]]; then pyenv install --skip-existing 2.7.14 && pyenv rehash && pyenv local 2.7.14; fi
- if [[ $TRAVIS_OS_NAME == linux ]]; then virtualenv -p python2.7 python_env; fi
- if [[ $TRAVIS_OS_NAME == linux ]]; then source python_env/bin/activate; fi
- if [[ $TRAVIS_OS_NAME == linux ]]; then pip install --upgrade pip; fi
- if [[ $TRAVIS_OS_NAME == linux ]]; then pip install mercurial --upgrade; fi
# install mercurial on Windows as some Go dependencies need it
- if [[ $TRAVIS_OS_NAME == windows ]]; then choco install -y hg; fi
install:
- $MAKE depend
script:
- $MAKE test
- GOOS=linux $MAKE build
- GOOS=darwin $MAKE build
- GOOS=windows $MAKE build
- $MAKE build
# QnB upload user (rightscale-binaries-upload-governance)
- export AWS_ACCESS_KEY_ID=AKIAIX27XNPUMQ25GSEQ
- export AWS_SECRET_ACCESS_KEY=${RSBIN_KEY}
- "[[ -z $AWS_SECRET_ACCESS_KEY ]] || make upload"
- "[[ -z $AWS_SECRET_ACCESS_KEY ]] || $MAKE upload"
8 changes: 6 additions & 2 deletions cmd/fpt/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
v1.0.7 / 2020-02-10
v1.0.8 / 2020-02-28
-------------------
* Add short flag (`-C`) for credentials to go along with `--credentials`.

v1.0.7 / 2020-02-28
-------------------
* Fix errors with incident index.

v1.0.6 / 2020-02-10
v1.0.6 / 2020-02-27
-------------------
* Add credential support on `fpt run` or `fpt retrieve_data`.

Expand Down
10 changes: 7 additions & 3 deletions cmd/fpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`fpt` is a command line tool to aid in the development and testing of [RightScale Policies](https://docs.rightscale.com/policies/). The tool is able to syntax check, upload, and run Policies.

[![Travis CI Build Status](https://travis-ci.com/rightscale/fpt.svg?token=6Udhsz2ZbD68aBb7ApTx&branch=master)](https://travis-ci.com/rightscale/fpt)
[![Travis CI Build Status](https://travis-ci.com/rightscale/policy_sdk.svg?branch=master)](https://travis-ci.com/rightscale/policy_sdk)

See [ChangeLog.md](https://github.com/rightscale/policy_sdk/tree/master/cmd/fpt/ChangeLog.md) for changes.

Expand Down Expand Up @@ -55,6 +55,8 @@ fpt run [<flags>] <file> [<options>...]
Example: fpt run max_snapshots.pt regions=us-east-1,us-west-2 max_snapshot_count=100
-C, --credentials=CREDENTIALS ...
Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>".
-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.
Expand All @@ -66,8 +68,10 @@ fpt retrieve_data [<flags>] <file> [<options>...]
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.
-C, --credentials=CREDENTIALS ...
Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>".
-n, --names=NAMES ... Names of resources/datasources to retrieve. By default, all datasources will be retrieved.
-o, --output-dir=OUTPUT-DIR Directory to store retrieved datasources.
fpt script [<flags>] <file> [<parameters>...]
Run the body of a script locally.
Expand Down
4 changes: 2 additions & 2 deletions cmd/fpt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ followed and incident printed out.
Example: fpt run max_snapshots.pt regions=us-east-1,us-west-2 max_snapshot_count=100`)
runFile = runCmd.Arg("file", "Policy Template file name.").Required().ExistingFile()
runOptions = runCmd.Arg("options", `Options are user-supplied values for "parameters" defined in the PolicyTemplate language. Options must be in the form of "<name>=<value>". For list parameters, a JSON encoded array or comma separated list may be passed as the value.`).Strings()
runCredentials = runCmd.Flag("credentials", `Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>.`).Strings()
runCredentials = runCmd.Flag("credentials", `Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>".`).Short('C').Strings()
runNoLog = runCmd.Flag("no-log", "Do not print policy execution log.").Short('n').Bool()
runKeep = runCmd.Flag("keep", "Keep applied policy running at end, for inspection in UI. Normally policy is terminated at the end.").Short('k').Bool()
runEscalations = runCmd.Flag("run-escalations", "If set, escalations will be run. Normally dry_run is set to avoid running any escalations.").Short('r').Bool()
Expand All @@ -53,7 +53,7 @@ Example: fpt retrieve_data my_policy.pt --names instances
`)
rdFile = rdCmd.Arg("file", "Policy Template file name.").Required().ExistingFile()
rdOptions = rdCmd.Arg("options", `Options are user-supplied values for "parameters" defined in the PolicyTemplate language. Options must be in the form of "<name>=<value>". For list parameters, a JSON encoded array or comma separated list may be passed as the value.`).Strings()
rdCredentials = rdCmd.Flag("credentials", `Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>.`).Strings()
rdCredentials = rdCmd.Flag("credentials", `Credentials is the map of name and credential used to launch the policy. Credentials must be of the form "--credentials <name1>=<value1> --credentials <name2>=<value2>".`).Short('C').Strings()
rdNames = rdCmd.Flag("names", "Names of resources/datasources to retrieve. By default, all datasources will be retrieved.").Short('n').Strings()
rdOD = rdCmd.Flag("output-dir", "Directory to store retrieved datasources.").Short('o').String()

Expand Down

0 comments on commit b12767c

Please sign in to comment.