-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: polish scripts (error handling, paths) #22
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bca3d5d
ENH: start script to help check when we need to activate an env
ZLLentz 4d45111
MAINT: simplify the python env script, checking is too slow
ZLLentz 2be2559
ENH: rename python activation script
ZLLentz 60d6e57
ENH: always activate the python env
ZLLentz 4dbdf49
ENH: add failure state and override for python env
ZLLentz abb38a5
MAINT: sourceable script does not need to be executable
ZLLentz b03718c
ENH/MAINT: rework the error handling to avoid bad states
ZLLentz f0305a6
ENH: bring paths into sourceable script, always cd to appease ansible
ZLLentz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# This is meant to be sourced. | ||
# Helper script for activating the correct python environment. | ||
# Sets a default env or you can provide your own activate path for testing | ||
|
||
DEFAULT_ENV=/cds/group/pcds/pyps/conda/venvs/ansible/bin/activate | ||
|
||
if [ -f "${ANSIBLE_PYTHON_ACTIVATE:=${DEFAULT_ENV}}" ]; then | ||
source "${ANSIBLE_PYTHON_ACTIVATE}" | ||
else | ||
echo "No Python activation script found at ${ANSIBLE_PYTHON_ACTIVATE}" | ||
return 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Sourceable script to set common vars for the various scripts. | ||
# This sets a bunch of environment variables related to known paths | ||
# and puts us into the ansible directory for the duration of the | ||
# encapsulating script. | ||
set -e | ||
|
||
THIS_SCRIPT="$(realpath "${BASH_SOURCE[0]}")" | ||
THIS_DIR="$(dirname "${THIS_SCRIPT}")" | ||
|
||
ANSIBLE_ROOT="$(realpath "${THIS_DIR}/..")" | ||
export ANSIBLE_ROOT | ||
INVENTORY_PATH="${ANSIBLE_ROOT}/inventory/plcs.yaml" | ||
export INVENTORY_PATH | ||
SSH_CONFIG="${ANSIBLE_ROOT}/ssh_config" | ||
export SSH_CONFIG | ||
|
||
cd "${ANSIBLE_ROOT}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Shouldn't we also return 0 if ANSIBLE_PYTHON_ACTIVATE was found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0 is implied, when the script rolls off the end without erroring or returning early