forked from pongasoft/glu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exec throws a new ShellExecException when failure added interrupt action to agent cli
- Loading branch information
Showing
11 changed files
with
426 additions
and
15 deletions.
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
64 changes: 64 additions & 0 deletions
64
...nkedin.glu.agent-api/src/main/groovy/org/linkedin/glu/agent/api/ShellExecException.groovy
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,64 @@ | ||
/* | ||
* Copyright (c) 2010-2011 LinkedIn, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.linkedin.glu.agent.api | ||
|
||
/** | ||
* @author yan@pongasoft.com */ | ||
public class ShellExecException extends ScriptException | ||
{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
int res | ||
byte[] output | ||
byte[] error | ||
|
||
ShellExecException() | ||
{ | ||
} | ||
|
||
ShellExecException(s) | ||
{ | ||
super(s) | ||
} | ||
|
||
ShellExecException(s, throwable) | ||
{ | ||
super(s, throwable) | ||
} | ||
|
||
String getStringOutput() | ||
{ | ||
return toStringOutput(output) | ||
} | ||
|
||
String getStringError() | ||
{ | ||
return toStringOutput(error) | ||
} | ||
|
||
/** | ||
* Converts the output into a string. Assumes that the encoding is UTF-8. Replaces all line feeds | ||
* by '\n' and remove the last line feed. | ||
*/ | ||
private String toStringOutput(byte[] output) | ||
{ | ||
if(output == null) | ||
return null | ||
|
||
return new String(output, "UTF-8").readLines().join('\n') | ||
} | ||
} |
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
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,56 @@ | ||
/* | ||
* Copyright (c) 2010-2011 LinkedIn, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
/** | ||
* Configuring for all scripts | ||
*/ | ||
|
||
import org.linkedin.gradle.tasks.SingleArtifactTask | ||
|
||
def gluScriptsTestProjectName = 'org.linkedin.glu.scripts.tests' | ||
|
||
configure(subprojects.findAll {it.name != gluScriptsTestProjectName}) { | ||
apply plugin: 'groovy' | ||
apply plugin: 'org.linkedin.release' | ||
|
||
release { | ||
releaseConfigurations << 'script' | ||
} | ||
|
||
dependencies { | ||
compile spec.external.linkedinUtilsGroovy | ||
compile project(':agent:org.linkedin.glu.agent-api') | ||
groovy spec.external.groovy | ||
|
||
//testCompile project(gluScriptsTestProjectName) | ||
testCompile spec.external.junit | ||
} | ||
|
||
def scripts = fileTree(dir: 'src/main/groovy', include: '**/*.groovy') | ||
|
||
scripts.each { File scriptFile -> | ||
def baseName = scriptFile.name - '.groovy' | ||
task([type: SingleArtifactTask], baseName) { | ||
artifactFile = scriptFile | ||
artifactReleaseInfo = | ||
[ | ||
name: baseName, | ||
extension: 'groovy', | ||
configurations: ['script'] | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.