Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
8b30ace9
Commit
8b30ace9
authored
Dec 26, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write cloudstorm credentials to file
parent
c3f29fd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
13 deletions
+11
-13
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+10
-10
Consumer.java
...r/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java
+0
-2
CloudCredentials.yml
openAPI/schema/CloudStorm/CloudCredentials.yml
+1
-1
No files found.
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
8b30ace9
...
...
@@ -83,7 +83,7 @@ class CloudStormService {
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
}
writeCloudStormCredentialsFiles
(
toscaTemplate
,
credentialsTempInputDirPath
);
writeCloudStormCredentialsFiles
(
credentialsTempInputDirPath
);
String
infrasCodeTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"infrasCodes"
;
File
infrasCodeTempInputDir
=
new
File
(
infrasCodeTempInputDirPath
);
if
(!(
infrasCodeTempInputDir
.
mkdirs
()))
{
...
...
@@ -99,7 +99,7 @@ class CloudStormService {
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
topTopology
.
setUserName
(
getUserName
());
Map
<
String
,
Object
>
subTopologiesAndVMs
=
getCloudsStormSubTopologiesAndVMs
(
t
oscaTemplate
,
t
empInputDirPath
);
Map
<
String
,
Object
>
subTopologiesAndVMs
=
getCloudsStormSubTopologiesAndVMs
(
tempInputDirPath
);
List
<
CloudsStormSubTopology
>
cloudsStormSubTopology
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
...
...
@@ -124,7 +124,7 @@ class CloudStormService {
return
"vm_user"
;
}
private
Map
<
String
,
Object
>
getCloudsStormSubTopologiesAndVMs
(
ToscaTemplate
toscaTemplate
,
String
tempInputDirPath
)
throws
ApiException
,
IOException
,
Exception
{
private
Map
<
String
,
Object
>
getCloudsStormSubTopologiesAndVMs
(
String
tempInputDirPath
)
throws
ApiException
,
IOException
,
Exception
{
List
<
NodeTemplateMap
>
vmTopologyTemplatesMap
=
helper
.
getVMTopologyTemplates
();
List
<
CloudsStormSubTopology
>
cloudsStormSubTopologies
=
new
ArrayList
<>();
Map
<
String
,
Object
>
cloudsStormMap
=
new
HashMap
<>();
...
...
@@ -179,7 +179,7 @@ class CloudStormService {
return
null
;
}
private
void
writeCloudStormCredentialsFiles
(
ToscaTemplate
toscaTemplate
,
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
private
void
writeCloudStormCredentialsFiles
(
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
helper
.
getVMTopologyTemplates
();
List
<
CloudCredential
>
cloudStormCredentialList
=
new
ArrayList
<>();
int
i
=
0
;
...
...
@@ -190,25 +190,25 @@ class CloudStormService {
cloudStormCredential
.
setCloudProvider
(
toscaCredentials
.
getCloudProviderName
());
String
credInfoFile
=
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
;
cloudStormCredential
.
setCredInfoFile
(
credInfoFile
);
cloudStormCredentialList
.
add
(
cloudStormCredential
);
CredentialInfo
cloudStormCredentialInfo
=
getCloudStormCredentialInfo
(
toscaCredentials
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"top.yml"
),
cloudStormCredentialInfo
);
CredentialInfo
cloudStormCredentialInfo
=
getCloudStormCredentialInfo
(
toscaCredentials
,
credentialsTempInputDirPath
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
),
cloudStormCredentialInfo
);
i
++;
}
CloudCredentials
cloudStormCredentials
=
new
CloudCredentials
();
cloudStormCredentials
.
setCloudCredential
(
cloudStormCredentialList
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"CloudStormCredentials.yml"
),
cloudStormCredentials
);
}
private
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
)
throws
FileNotFoundException
{
private
CredentialInfo
getCloudStormCredentialInfo
(
Credential
toscaCredentials
,
String
tmpPath
)
throws
FileNotFoundException
{
CredentialInfo
cloudStormCredentialInfo
=
new
CredentialInfo
();
switch
(
toscaCredentials
.
getCloudProviderName
().
toLowerCase
())
{
case
"exogeni"
:
String
base64Keystore
=
toscaCredentials
.
getKeys
().
get
(
"keystore"
);
byte
[]
decoded
=
Base64
.
getDecoder
().
decode
(
base64Keystore
);
try
(
PrintWriter
out
=
new
PrintWriter
(
"user.jks"
))
{
try
(
PrintWriter
out
=
new
PrintWriter
(
tmpPath
+
File
.
separator
+
"user.jks"
))
{
out
.
println
(
new
String
(
decoded
));
}
cloudStormCredentialInfo
.
setUserKeyName
(
"user.jks"
);
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/Consumer.java
View file @
8b30ace9
...
...
@@ -84,8 +84,6 @@ public class Consumer extends DefaultConsumer {
String
response
=
objectMapper
.
writeValueAsString
(
responceMessage
);
logger
.
log
(
Level
.
INFO
,
"Sending Response: '{'0'}'{0}"
,
response
);
// Logger.getLogger(Consumer.class.getName()).log(Level.INFO, "Sending Response: {0}", response);
//We send the response back. No need to change anything here
channel
.
basicPublish
(
""
,
properties
.
getReplyTo
(),
replyProps
,
response
.
getBytes
(
"UTF-8"
));
channel
.
basicAck
(
envelope
.
getDeliveryTag
(),
false
);
}
catch
(
JSchException
|
ApiException
ex
)
{
...
...
openAPI/schema/CloudStorm/CloudCredentials.yml
View file @
8b30ace9
CloudCredential
s
:
cloudCred
s
:
type
:
"
object"
properties
:
CloudCredential
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment