JClouds: Executing a long script - jclouds

I am using JClouds to execute the scripts in the servers that I am creating in the cloud.
The problem that I am having is that the script that I run will take around 40 minutes to finish.
My questions are:
1) How can I avoid the timeout ?
2) JClouds's SshClient will try 5 times. Is there any way to limit the number of retries ?
Although JClouds thinks that the script failed, the script was successfully executed in the server.
So far the code that I use to execute scripts looks like this:
org.jclouds.ssh.SshClient sshClient = null;
Properties overrides = new Properties();
overrides.setProperty(ComputeServiceProperties.POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS);
overrides.setProperty(ComputeServiceProperties.POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS);
overrides.setProperty(ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE, String.valueOf(18000000));
ComputeServiceContext context;
try {
context = ContextBuilder.newBuilder(provider.getProvider_cs())
.credentials(providerCredentials.getClientId(), providerCredentials.getKey())
.modules(modules)
.overrides(overrides)
.buildView(ComputeServiceContext.class);
} catch (Exception e) {
context = null;
log.error("Error while creating ComputeServiceContext ", e);
}
if (context != null ) {
try {
String host = cloudServer.getDaemon().getHost();
int port = cloudServer.getDaemon().getPort();
String username = cloudServer.getCredential().getUsername();
String password = cloudServer.getCredential().getPassword();
String privKey = cloudServer.getCredential().getPrivKey();
if (password == null || password.isEmpty()) {
sshClient = context.utils().sshFactory().create(HostAndPort.fromParts(host, port),
LoginCredentials.builder().user(username).privateKey(privKey).build());
} else {
sshClient = context.utils().sshFactory().create(HostAndPort.fromParts(host, port),
LoginCredentials.builder().user(username).password(password).build());
}
} catch (Exception e) {
log.error("Error while building sshClient nodeMetaData", e);
}
}
// put the script in the server
if ( sshClient != null ) {
log.info("Putting file");
try {
sshClient.put(scriptFile.getScriptPath(), scriptFile.getContent());
} catch (Exception e) {
log.error("Error while uploading script", e);
}
}
// run the script
if ( sshClient != null ) {
log.info("Running script");
try {
String script = getScriptContent(); // the script will take around 40 minutes to be executed
log.info(script);
ExecResponse response = sshClient.exec(script);
if (response.getExitStatus() != 0) {
log.error("Error while executing script: " + response.getError());
}
} catch (Exception e) {
log.error("Error while executing script", e);
}
}
Logs:
11:48:39.648 INFO com.r3systems.manageacloud.service.CloudService:257 - Putting file
11:48:40.087 INFO n.s.sshj.connection.channel.direct.SessionChannel:207 - Will request `sftp` subsystem
11:48:41.739 INFO com.r3systems.manageacloud.service.CloudService:267 - Running script
11:48:41.740 INFO com.r3systems.manageacloud.service.CloudService:270 - #!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
11:48:42.149 INFO n.s.sshj.connection.channel.direct.SessionChannel:120 - Will request to exec `#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
`
11:49:00.957 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:49:00.958 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:54:06.421 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:54:06.421 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:54:06.423 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - BY_APPLICATION
11:54:06.425 INFO jclouds.ssh:68 - << (root:rsa[fingerprint(1d:7c:f8:7e:b0:f4:23:a2:bc:2e:22:69:8a:4a:5b:a4),sha1(14:14:f4:d3:71:72:8a:c1:d3:b3:a2:c5:71:b4:e0:98:7b:03:c3:6c)]#198.199.97.55:22) error acquiring ExecResponse(command=[#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
]) (attempt 1 of 5): Read timed out
11:54:06.634 WARN net.schmizz.sshj.DefaultConfig:159 - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
11:54:06.806 INFO net.schmizz.sshj.transport.TransportImpl:152 - Client identity string: SSH-2.0-SSHJ_0_8_1_SNAPSHOT
11:54:07.000 INFO net.schmizz.sshj.transport.TransportImpl:161 - Server identity string: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u1
11:54:08.623 INFO n.s.sshj.connection.channel.direct.SessionChannel:120 - Will request to exec `#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
`
11:55:10.680 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:55:10.680 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:55:10.682 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - BY_APPLICATION
11:55:10.683 INFO jclouds.ssh:68 - << (root:rsa[fingerprint(1d:7c:f8:7e:b0:f4:23:a2:bc:2e:22:69:8a:4a:5b:a4),sha1(14:14:f4:d3:71:72:8a:c1:d3:b3:a2:c5:71:b4:e0:98:7b:03:c3:6c)]#198.199.97.55:22) error acquiring ExecResponse(command=[#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
]) (attempt 2 of 5): Read timed out
11:55:11.547 WARN net.schmizz.sshj.DefaultConfig:159 - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
11:55:11.724 INFO net.schmizz.sshj.transport.TransportImpl:152 - Client identity string: SSH-2.0-SSHJ_0_8_1_SNAPSHOT
11:55:11.961 INFO net.schmizz.sshj.transport.TransportImpl:161 - Server identity string: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u1
11:55:13.614 INFO n.s.sshj.connection.channel.direct.SessionChannel:120 - Will request to exec `#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
`
11:56:15.360 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:56:15.360 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:56:15.361 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - BY_APPLICATION
11:56:15.363 INFO jclouds.ssh:68 - << (root:rsa[fingerprint(1d:7c:f8:7e:b0:f4:23:a2:bc:2e:22:69:8a:4a:5b:a4),sha1(14:14:f4:d3:71:72:8a:c1:d3:b3:a2:c5:71:b4:e0:98:7b:03:c3:6c)]#198.199.97.55:22) error acquiring ExecResponse(command=[#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
]) (attempt 3 of 5): Read timed out
11:56:17.336 WARN net.schmizz.sshj.DefaultConfig:159 - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
11:56:17.537 INFO net.schmizz.sshj.transport.TransportImpl:152 - Client identity string: SSH-2.0-SSHJ_0_8_1_SNAPSHOT
11:56:17.759 INFO net.schmizz.sshj.transport.TransportImpl:161 - Server identity string: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u1
11:56:19.789 INFO n.s.sshj.connection.channel.direct.SessionChannel:120 - Will request to exec `#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
`
11:57:22.530 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:57:22.531 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:57:22.532 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - BY_APPLICATION
11:57:22.534 INFO jclouds.ssh:68 - << (root:rsa[fingerprint(1d:7c:f8:7e:b0:f4:23:a2:bc:2e:22:69:8a:4a:5b:a4),sha1(14:14:f4:d3:71:72:8a:c1:d3:b3:a2:c5:71:b4:e0:98:7b:03:c3:6c)]#198.199.97.55:22) error acquiring ExecResponse(command=[#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
]) (attempt 4 of 5): Read timed out
11:57:24.537 WARN net.schmizz.sshj.DefaultConfig:159 - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
11:57:24.714 INFO net.schmizz.sshj.transport.TransportImpl:152 - Client identity string: SSH-2.0-SSHJ_0_8_1_SNAPSHOT
11:57:24.930 INFO net.schmizz.sshj.transport.TransportImpl:161 - Server identity string: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u1
11:57:26.592 INFO n.s.sshj.connection.channel.direct.SessionChannel:120 - Will request to exec `#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash very_long_script.sh
exit $?
`
11:58:27.844 ERROR net.schmizz.sshj.transport.TransportImpl:570 - Dying because - java.net.SocketTimeoutException: Read timed out
11:58:27.845 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - UNKNOWN
11:58:27.847 INFO net.schmizz.sshj.transport.TransportImpl:93 - Disconnected - BY_APPLICATION
11:58:27.850 ERROR jclouds.ssh:96 - << (root:rsa[fingerprint(1d:7c:f8:7e:b0:f4:23:a2:bc:2e:22:69:8a:4a:5b:a4),sha1(14:14:f4:d3:71:72:8a:c1:d3:b3:a2:c5:71:b4:e0:98:7b:03:c3:6c)]#198.199.97.55:22) error acquiring ExecResponse(command=[#!/bin/bash
set +u
shopt -s xpg_echo
shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH
function abort {
echo "aborting: $#" 1>&2
exit 1
}
export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
DATE=`date -u +"%Y%m%d%H%M"`
bash very_long_script.sh
exit $?
]) (out of retries - max 5): Read timed out
net.schmizz.sshj.common.SSHException: Read timed out
at net.schmizz.sshj.common.SSHException$1.chain(SSHException.java:56) ~[sshj-0.8.1.jar:na]
at net.schmizz.sshj.common.SSHException$1.chain(SSHException.java:49) ~[sshj-0.8.1.jar:na]
at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:572) ~[sshj-0.8.1.jar:na]
at net.schmizz.sshj.transport.Reader.run(Reader.java:79) ~[sshj-0.8.1.jar:na]
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_21]
at java.net.SocketInputStream.read(SocketInputStream.java:150) ~[na:1.7.0_21]
at java.net.SocketInputStream.read(SocketInputStream.java:121) ~[na:1.7.0_21]
at net.schmizz.sshj.transport.Reader.run(Reader.java:68) ~[sshj-0.8.1.jar:na]

This is an old question, but I'm hoping this will help someone in this situation in the future.
I'm building the SSH client directly but through a guice injector and am able to set timeout through dependency injection:
protected SshClient getSshClient(String nodeHostName, String username,
String password) {
final long timeout = 300000;
Injector i = Guice.createInjector(new SshjSshClientModule() {
#Override
protected void configure() {
super.configure();
bindConstant().annotatedWith(
Names.named(Constants.PROPERTY_CONNECTION_TIMEOUT)).to(
timeout);
}
});
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
SshClient connection = null;
connection = factory.create(
HostAndPort.fromParts(nodeHostName, SSH_PORT), LoginCredentials
.builder().user(username).password(password)
.authenticateSudo(false).build());
return connection;
}

when you create the context in the "override properties"
try setting also this property: Constants.PROPERTY_CONNECTION_TIMEOUT
by default it is 60000
and it is the ssh connection timeout try setting it to a bigger value
Properties overrides = new Properties();
overrides .put(Constants.PROPERTY_CONNECTION_TIMEOUT,"600000000");

Related

Golang os.Getenv(key) returning entire env file instead of just the key's value

I'm a developer who's recently moved from macOS to WSL2 on Windows 10. I've finally managed to get everything working, but when I call a lambda locally through Docker, the os.Getenv() function returns my whole env file, instead of just the one key.
Things I've tried:
Set "files.eol" = "\n" in vscode settings.json
Set core.autocrlf = input in git config --global
Set eol = lf in git config --global
I've been super stumped for ages, and haven't been able to find any solutions online. Any help would be super appreciated!
Edit: Apologies, I should have had the foresight to post the code and env. necessary to replicate the problem
////////////
// Code: //
////////////
func init() {
if err := config.Load(); err != nil {
api.ReportError(err)
}
dbo = db.Instance{
DSN: os.Getenv("DBReadDataSourceName"),
}
log.Println("DSN: ", dbo.DSN)
}
// Load ...
func Load() error {
stage := os.Getenv("Stage")
log.Println("stage: ", stage)
if len(data) <= 0 && stage != "local" {
log.Println("stage != local")
log.Println("do production config and ssm stuff")
}
return nil
}
//////////
// Env: //
//////////
Stage=local
ServerPort=:1234
DBDriverName=mysql
DBReadDataSourceName=MySQLReadDataSourceCredentials
DBWriteDataSourceName=MySQLWriteDataSourceCredentials
RiakAddress=RiakAddress
RedisAddress=RedisAddress
ElasticSearchUrl=ElasticSearchUrl
ElasticSearchPrefix=ElasticSearchPrefix
ThidPartyBaseURL=https://api-sandbox.ThirdParty.com
ThidPartyCountryCode=SG
ThidPartyClientID=asdf12345qwertyuiadsf
ThidPartyClientSecret=asdf12345qwertyuiadsf
/////////////
// Output: //
/////////////
2020/07/13 17:04:03 stage: local
ServerPort=:1234
DBDriverName=mysql
DBReadDataSourceName=MySQLReadDataSourceCredentials
DBWriteDataSourceName=MySQLWriteDataSourceCredentials
RiakAddress=RiakAddress
RedisAddress=RedisAddress
ElasticSearchUrl=ElasticSearchUrl
ElasticSearchPrefix=ElasticSearchPrefix
ThidPartyBaseURL=https://api-sandbox.ThirdParty.com
ThidPartyCountryCode=SG
ThidPartyClientID=asdf12345qwertyuiadsf
ThidPartyClientSecret=asdf12345qwertyuiadsf
2020/07/13 17:04:03 stage != local
2020/07/13 17:04:03 do production config and ssm stuff
2020/07/13 17:04:03 DSN: DBReadDataSourceName
When I run this lambda locally on a mac, os.Getenv() functions as intended, returning local for Stage, and returning MySQLReadDataSourceCredentials for DBReadDataSourceName. However, running this lambda locally through WSL2 on a windows machine results in the above output. Stage returns the entire file, and DBReadDataSourceName returns DBReadDataSourceName.
I'm super stumped, and have tried everything I could think of, including manually writing \r\n on the end of each env. value. Any help would be extremely appreciated! Thank you very much for your time
Edit 2: From the comments
The command I used to load the env. file is env -S "`cat env.local`" sam local start-api --template template.yaml --profile company_local, with env.local being the file name.
The command env -S $'a=5\nb=6' sh -c 'echo "$a"' prints
5
b=6
The command env -S $'a=5\r\nb=6' sh -c 'echo "$a"' prints the exact same output as above,
5
b=6
The command env -S 'a=5;b=6' sh -c 'echo "$a"' prints
5;b=6
And env -S 'a=5:b=6' sh -c 'echo "$a"' prints
5:b=6
And the command xxd env.local | head -n 3 prints
00000000: 5374 6167 653d 6c6f 6361 6c0a 5365 7276 Stage=local.Serv
00000010: 6572 506f 7274 3d3a 3132 3334 0a44 4244 erPort=:1234.DBD
00000020: 7269 7665 724e 616d 653d 6d79 7371 6c0a riverName=mysql.

Initiate an email based on script output or console output in Jenkins

I have a script which basically fetches the http response codes. I want to trigger an email for response code anything apart from 200. I do not want to trigger mail using script. Is there any way to send a mail in post build actions ?
Kindly assist.
#!/bin/bash
date
if [ $# -eq 0 ]; then
cat /home/ubuntu/check_kibana/lists.txt | while read output
do
RESP=$(curl -sL $output -w "%{http_code} \n" -o /dev/null)
if [ $RESP -eq 200 ]; then
echo "ResponseCode: $RESP, Service is active."
else
echo "ResponseCode: $RESP, $output is not active."
echo "ResponseCode: $RESP for $output. Please check as the service may be down or not listening to the designated port." | mail -s "Error triggered for unavailable kibana service" xxxxxxxxx#gmail.com
fi
done
fi
If you are running this as a build step then you need to add exit 1; in the else part of the response code check. This will mark the build step as a failure and then you can set up an email trigger using "Email Notification" as a post-build step. In case, If you want to have personalized email then you can use "Editable Email Notification" plugin.
So, your script should be something like this
#!/bin/bash
date
if [ $# -eq 0 ]; then
cat /home/ubuntu/check_kibana/lists.txt | while read output
do
RESP=$(curl -sL $output -w "%{http_code} \n" -o /dev/null)
if [ $RESP -eq 200 ]; then
echo "ResponseCode: $RESP, Service is active."
else
exit 1; # Any exit code except 0 will mark the build step as the failure
echo "ResponseCode: $RESP, $output is not active."
echo "ResponseCode: $RESP for $output. Please check as the service may be down or not listening to the designated port." | mail -s "Error triggered for unavailable kibana service" pruthvi.basagodu#gmail.com
fi
done
fi
To fix the above issue, we need to know that Jenkins will trigger the email notification only if the build fails or changes from failure to success. (depends on how you want to trigger an email via Jenkins).
I have found a way to solve the above issue. Instead of shell script, python would be right choice for me me as it is very flexible to play around with the various libraries and variables. So, those who want to trigger an email based on the loop conditions in the script, go with python or any OOP languages.
Shell script will only run the script and sets the build status. If I am wrong, I'd be happy receive the suggestions.

Erlang shell - no input for commands

My os: arch linux. I recently installed erlang (Erlang (BEAM) emulator version 9.0.1).
When I type "erl" command I expect the erlang shell to start invoking the commands I type (for the simplest example: 2+3. should return 5)
However, after I run "erl" nothing shows up on screen. I can type anything I want, nothing is executed. Images with example are attached.
What I expect.jpg
What I got.jpg
Now I only started to learn erlang, and this is confusing. Don't know if it is some repository bug, or erlang normal behavior?
UPD: I got some custom configuration in .bashrc file:
# setup color variables
color_is_on=
color_red=
color_green=
color_yellow=
color_blue=
color_white=
color_gray=
color_bg_red=
color_off=
color_user=
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_is_on=true
color_black="\[$(/usr/bin/tput setaf 0)\]"
color_red="\[$(/usr/bin/tput setaf 1)\]"
color_green="\[$(/usr/bin/tput setaf 2)\]"
color_yellow="\[$(/usr/bin/tput setaf 3)\]"
color_blue="\[$(/usr/bin/tput setaf 6)\]"
color_white="\[$(/usr/bin/tput setaf 7)\]"
color_gray="\[$(/usr/bin/tput setaf 8)\]"
color_off="\[$(/usr/bin/tput sgr0)\]"
color_error="$(/usr/bin/tput setab 1)$(/usr/bin/tput setaf 7)"
color_error_off="$(/usr/bin/tput sgr0)"
# set user color
case `id -u` in
0) color_user=$color_red ;;
*) color_user=$color_green ;;
esac
fi
function prompt_command {
# get cursor position and add new line if we're not in first column
exec < /dev/tty
local OLDSTTY=$(stty -g)
stty raw -echo min 0
echo -en "\033[6n" > /dev/tty && read -sdR CURPOS
stty $OLDSTTY
[[ ${CURPOS##*;} -gt 1 ]] && echo "${color_error}ā†µ${color_error_off}"
# build b/w prompt for git and vertial env
[[ ! -z $GIT_BRANCH ]] && PS1_GIT=" (git: ${GIT_BRANCH})"
[[ ! -z $VIRTUAL_ENV ]] && PS1_VENV=" (venv: ${VIRTUAL_ENV#$WORKON_HOME})"
# calculate fillsize
local fillsize=$(($COLUMNS-$(printf "${USER}#${HOSTNAME}:${PWD}:${PWDNAME}${PS1_GIT}${PS1_VENV} " | wc -c | tr -d " ")))
local FILL=$color_white
while [ $fillsize -gt 0 ]; do FILL="${FILL}ā”€"; fillsize=$(($fillsize-1)); done
FILL="${FILL}${color_off}"
# set new color prompt
PS1="${color_user}${USER}${color_off}#${color_yellow}${HOSTNAME}${color_off}:${color_white}${PWD}:${PWDNAME}${color_off}${PS1_GIT}${PS1_VENV} ${FILL}\nāžœ "
}
PROMPT_COMMAND=prompt_command
After removing this configuration, erl started to work normally.

XCode trying to locate service account file

When I try to build my Project in XCode, I get the following dialog box:
It asks for a service account file which I am not sure of.
If I cancel it, I get the following error in upload-symbol-util.bash file:
# If the token will expire in the next sixty seconds (or already
# has), reload it.
if ! fcr_verify_tok_plist; then
xcdebug "Token is invalid. Refreshing..."
if ! fcr_verify_svc_plist; then
xcdebug "Service account information is invalid. Requesting reload..."
if [[ "$SERVICE_ACCOUNT_FILE" && -f "$SERVICE_ACCOUNT_FILE" ]]; then
xcdebug "Using $SERVICE_ACCOUNT_FILE for credentials."
else
SERVICE_ACCOUNT_FILE="$(/usr/bin/osascript -e 'the POSIX path of (choose file with prompt "Where is the service account file?" of type "public.json")' 2>/dev/null)"
fi
/usr/libexec/PlistBuddy "$SVC_PLIST" \
-c "Add :version integer 1"
if [[ "$SERVICE_ACCOUNT_FILE" && -f "$SERVICE_ACCOUNT_FILE" ]]; then
/usr/bin/plutil -replace "$APP_KEY" -json "$(/bin/cat "$SERVICE_ACCOUNT_FILE")" "$SVC_PLIST" || return 2
if fcr_verify_svc_plist; then
xcdebug "Installed service account file into $SVC_PLIST."
else
/usr/libexec/PlistBuddy "$SVC_PLIST" -c "Delete $APP_KEY" >/dev/null 2>&1
xcerror "Unable to parse service account file."
return 2
fi
else
xcerror "User cancelled symbol uploading." // Getting Error here
return 1
fi
fi
Please tell what is a Service Account file and where do I find it?

Capistrano deploy incomplete

I want to deploy a local application to a production server with Capistrano. However something fails and I don't know how to fix it. The good news is that the /shared/cached-copy is fully created on the remote server. How can I fix the rsync error?
cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git#bitbucket.org:foo/bar.git HEAD"
* executing "if [ -d /path/foo/shared/cached-copy ]; then cd /path/foo/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard e216d5f840f3d78458a3734a3830a4030750c85c && git clean -q -d -x -f; else git clone -q git#bitbucket.org:foo/bar.git /path/foo/shared/cached-copy && cd /path/foo/shared/cached-copy && git checkout -q -b deploy e216d5f840f3d78458a3734a3830a4030750c85c; fi"
servers: ["foo.com"]
[foo.com] executing command
command finished in 33589ms
copying the cached version to /path/foo/releases/20120204063129
* executing "rsync -lrpt --exclude=\".git\" --exclude=\".DS_Store\" --exclude=\".gitignore\" --exclude=\".gitmodules\" /path/foo/shared/cached-copy/ /path/foo/releases/20120204063129 && (echo e216d5f840f3d78458a3734a3830a4030750c85c > /path/foo/releases/20120204063129/REVISION)"
servers: ["foo.com"]
[foo.com] executing command
*** [err :: foo.com] rsync: mkdir "/path/foo/releases/20120204063129" failed: No such file or directory (2)
*** [err :: foo.com] rsync error: error in file IO (code 11) at main.c(587) [Receiver=3.0.8]
*** [err :: foo.com] rsync: connection unexpectedly closed (9 bytes received so far) [sender]
*** [err :: foo.com] rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.8]
command finished in 899ms
*** [deploy:update_code] rolling back
* executing "rm -rf /path/foo/releases/20120204063129; true"
servers: ["foo.com"]
[foo.com] executing command
command finished in 841ms
failed: "sh -c 'rsync -lrpt --exclude=\".git\" --exclude=\".DS_Store\" --exclude=\".gitignore\" --exclude=\".gitmodules\" /path/foo/shared/cached-copy/ /path/foo/releases/20120204063129 && (echo e216d5f840f3d78458a3734a3830a4030750c85c > /path/foo/releases/20120204063129/REVISION)'" on foo.com
My deploy.rb file:
set :application, "FooBar"
set :repository, "git#bitbucket.org:foo/bar.git"
set :scm, :git
set :deploy_to, "/path/foo"
set :deploy_via, :remote_cache
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"]
set :user, "foobar"
server "foobar.tdl", :app
ssh_options[:forward_agent] = true
It looks like your first error is:
*** [err :: foo.com] rsync: mkdir "/path/foo/releases/20120204063129" failed: No such file or directory (2)
Does your /path/foo/releases directory already exist on the server? Try creating it.

Resources