Skip to content

Commit

Permalink
possible fix for: 'unicode' does not have the buffer interface #27
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed May 6, 2019
1 parent 75cdd3a commit bbd7fb2
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 8 deletions.
4 changes: 2 additions & 2 deletions contents/winrm_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def _clean_error_msg(self, msg):
# if any of the above fails, the msg was not true xml
# print a warning and return the orignal string
# TODO do not print, raise user defined error instead
print("Warning: there was a problem converting the Powershell"
" error message: %s" % (e))
# print("Warning: there was a problem converting the Powershell")
ignore_error = True
else:
# if new_msg was populated, that's our error message
# otherwise the original error message will be used
Expand Down
3 changes: 2 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ services:
- RUNDECK_USER=admin
- RUNDECK_PASSWORD=admin
# import projects
- CONFIG_SCRIPT_POSTSTART=scripts/import_project.sh
- CONFIG_SCRIPT_POSTSTART=scripts/import_project.sh,scripts/import_keys.sh
#- PROJECTS_LIST=WINRM-DEMO
volumes:
- ${PWD}/projects:/projects
- ${PWD}/storage:/storage
3 changes: 2 additions & 1 deletion docker/rundeck-ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ RUN apt-get -y update && \
iputils-ping \
net-tools \
apt-transport-https \
git
git \
jq

## Install Java
RUN \
Expand Down
24 changes: 24 additions & 0 deletions docker/rundeck-ops/scripts/import_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

#trap 'echo "rd fail" ; exit 0' EXIT
set -eu
shopt -s nullglob
ARCHIVES=(/storage/*.json)
shopt -u nullglob

echo "There are ${#ARCHIVES[*]} storage files"

for file in "${ARCHIVES[@]}"
do
for row in $(cat "${file}" | jq -c .[] | tr -d '^J'); do
_jq() {
echo ${row} | jq -r ${1}
}
echo "Creating key: $(_jq '.key')"

tmpfile=$(mktemp /tmp/key.XXXXXX)
echo $(_jq '.value') > ${tmpfile}
rd keys create -t password -p $(_jq '.key') -f ${tmpfile}
rm ${tmpfile}
done
done
3 changes: 0 additions & 3 deletions docker/rundeck-ops/scripts/import_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ shopt -u nullglob

echo "There are ${#ARCHIVES[*]} project archives to import"

#default rundeck user password for key storage
echo "rundeck" > tmp.password

for file in "${ARCHIVES[@]}"
do
echo "Importing archive file $file ..."
Expand Down
3 changes: 2 additions & 1 deletion docker/rundeck-ops/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ run_helpers() {
continue
}
echo "### applying $helper script: $script"
. "$script"
bash "$script"
done
}

Expand Down Expand Up @@ -69,4 +69,5 @@ else
echo "### Post start config not set. skipping..."
fi


exit 0
1 change: 1 addition & 0 deletions docker/rundeck/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get -y update && \
netcat-traditional \
unzip \
zip \
vim \
jq \
sysstat

Expand Down
9 changes: 9 additions & 0 deletions docker/storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
put json files on this folder with the following json format
```
[
{"key":"keys/node/windows.password","value": "123456."},
{"key":"keys/node/windows2.password","value" : "123456."}
]
```

0 comments on commit bbd7fb2

Please sign in to comment.