|
@@ -233,24 +233,28 @@ HEADER;
|
|
|
|
|
|
exec("cd $GIT_HOME && GIT_SSH_COMMAND='ssh -i $GIT_HOME/../../.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' /usr/local/bin/git commit -m 'Update switch targets from ZTP' $YAML_FILE", $output, $result);
|
|
|
if ($result != 0) {
|
|
|
- if (!$is_script) {
|
|
|
- echo "<p><font color=\"red\">Error committing changes to git:</p>\r\n";
|
|
|
- echo "<pre>\r\n";
|
|
|
- } else {
|
|
|
- echo "Error committing changes to git:\n";
|
|
|
- }
|
|
|
- foreach ($output as $line) {
|
|
|
- echo "$line";
|
|
|
- if ($is_script) {
|
|
|
- echo "\n";
|
|
|
+ if ($output[0] != "Your branch is up to date") {
|
|
|
+ if (!$is_script) {
|
|
|
+ echo "<p><font color=\"red\">Error committing changes to git:</p>\r\n";
|
|
|
+ echo "<pre>\r\n";
|
|
|
} else {
|
|
|
- echo "\r\n";
|
|
|
+ echo "Error committing changes to git:\n";
|
|
|
}
|
|
|
+ foreach ($output as $line) {
|
|
|
+ echo "$line";
|
|
|
+ if ($is_script) {
|
|
|
+ echo "\n";
|
|
|
+ } else {
|
|
|
+ echo "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!$is_script) {
|
|
|
+ echo "</pre></font>\r\n";
|
|
|
+ }
|
|
|
+ exit(1);
|
|
|
+ } else {
|
|
|
+ exit(0);
|
|
|
}
|
|
|
- if (!$is_script) {
|
|
|
- echo "</pre></font>\r\n";
|
|
|
- }
|
|
|
- exit(1);
|
|
|
}
|
|
|
|
|
|
exec("cd $GIT_HOME && GIT_SSH_COMMAND='ssh -i $GIT_HOME/../../.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' /usr/local/bin/git push", $output, $result);
|