-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create new Storage class. * Create new Strings class. Co-authored-by: Karl DeBisschop <[email protected]>
- Loading branch information
1 parent
da1038c
commit 5f2b14b
Showing
16 changed files
with
212 additions
and
229 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
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
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,34 @@ | ||
package com.bioraft.rundeck.rancher; | ||
|
||
import com.dtolabs.rundeck.core.execution.ExecutionContext; | ||
import com.dtolabs.rundeck.core.storage.ResourceMeta; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
|
||
public class Storage { | ||
|
||
private final ExecutionContext context; | ||
|
||
public Storage(final ExecutionContext context) { | ||
this.context = context; | ||
} | ||
|
||
/** | ||
* Get a (secret) value from password storage. | ||
* | ||
* @param passwordStoragePath The path to look up in storage. | ||
* @return The requested secret or password. | ||
* @throws IOException When there is an IO Exception writing to stream. | ||
*/ | ||
public String loadStoragePathData(final String passwordStoragePath) throws IOException { | ||
if (null == passwordStoragePath) { | ||
throw new IOException("Storage path is not defined."); | ||
} | ||
ResourceMeta contents = context.getStorageTree().getResource(passwordStoragePath).getContents(); | ||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | ||
contents.writeContent(byteArrayOutputStream); | ||
return new String(byteArrayOutputStream.toByteArray()); | ||
} | ||
|
||
} |
Oops, something went wrong.