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
3c78f488
Commit
3c78f488
authored
Nov 04, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implmemted rabbitmq logging for user
parent
eb3081f7
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
88 deletions
+119
-88
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+15
-0
ProvisionService.java
...in/java/nl/uva/sne/drip/api/service/ProvisionService.java
+104
-88
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
3c78f488
...
@@ -51,6 +51,7 @@ import nl.uva.sne.drip.api.dao.KeyPairDao;
...
@@ -51,6 +51,7 @@ import nl.uva.sne.drip.api.dao.KeyPairDao;
import
nl.uva.sne.drip.api.exception.BadRequestException
;
import
nl.uva.sne.drip.api.exception.BadRequestException
;
import
nl.uva.sne.drip.api.exception.KeyException
;
import
nl.uva.sne.drip.api.exception.KeyException
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.commons.utils.DRIPLogHandler
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ConfigurationRepresentation
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ConfigurationRepresentation
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.KeyPair
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.KeyPair
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest
;
...
@@ -94,6 +95,13 @@ public class DeployService {
...
@@ -94,6 +95,13 @@ public class DeployService {
private
static
final
String
[]
CLOUD_SITE_NAMES
=
new
String
[]{
"domain"
,
"VMResourceID"
};
private
static
final
String
[]
CLOUD_SITE_NAMES
=
new
String
[]{
"domain"
,
"VMResourceID"
};
private
static
final
String
[]
PUBLIC_ADRESS_NAMES
=
new
String
[]{
"public_address"
,
"publicAddress"
};
private
static
final
String
[]
PUBLIC_ADRESS_NAMES
=
new
String
[]{
"public_address"
,
"publicAddress"
};
private
final
Logger
logger
;
@Autowired
public
DeployService
()
throws
IOException
,
TimeoutException
{
logger
=
Logger
.
getLogger
(
DeployService
.
class
.
getName
());
logger
.
addHandler
(
new
DRIPLogHandler
(
messageBrokerHost
));
}
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
@PostAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
DeployResponse
findOne
(
String
id
)
throws
JSONException
,
IOException
,
TimeoutException
,
InterruptedException
{
public
DeployResponse
findOne
(
String
id
)
throws
JSONException
,
IOException
,
TimeoutException
,
InterruptedException
{
...
@@ -145,12 +153,15 @@ public class DeployService {
...
@@ -145,12 +153,15 @@ public class DeployService {
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "deployer_ansible_response_benchmark.json");
// + File.separator + "deployer_ansible_response_benchmark.json");
logger
.
info
(
"Calling deployer"
);
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
logger
.
info
(
"Got response from deployer"
);
List
<
MessageParameter
>
params
=
response
.
getParameters
();
List
<
MessageParameter
>
params
=
response
.
getParameters
();
DeployResponse
deploy
=
handleResponse
(
params
,
deployInfo
);
DeployResponse
deploy
=
handleResponse
(
params
,
deployInfo
);
deploy
.
setProvisionID
(
deployInfo
.
getProvisionID
());
deploy
.
setProvisionID
(
deployInfo
.
getProvisionID
());
deploy
.
setConfigurationID
(
deployInfo
.
getConfigurationID
());
deploy
.
setConfigurationID
(
deployInfo
.
getConfigurationID
());
deploy
.
setManagerType
(
deployInfo
.
getManagerType
().
toLowerCase
());
deploy
.
setManagerType
(
deployInfo
.
getManagerType
().
toLowerCase
());
logger
.
info
(
"Deployment saved"
);
save
(
deploy
);
save
(
deploy
);
return
deploy
;
return
deploy
;
...
@@ -172,7 +183,9 @@ public class DeployService {
...
@@ -172,7 +183,9 @@ public class DeployService {
Map
<
String
,
Object
>
info
;
Map
<
String
,
Object
>
info
;
deployerInvokationMessage
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
deployerInvokationMessage
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
try
(
DRIPCaller
deployer
=
new
DeployerCaller
(
messageBrokerHost
);)
{
try
(
DRIPCaller
deployer
=
new
DeployerCaller
(
messageBrokerHost
);)
{
logger
.
info
(
"Calling deployer"
);
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
logger
.
info
(
"Got response from deployer"
);
List
<
MessageParameter
>
params
=
response
.
getParameters
();
List
<
MessageParameter
>
params
=
response
.
getParameters
();
info
=
buildSwarmInfo
(
params
);
info
=
buildSwarmInfo
(
params
);
}
}
...
@@ -326,7 +339,9 @@ public class DeployService {
...
@@ -326,7 +339,9 @@ public class DeployService {
Message
message
=
buildDeployerMessage
(
deployment
.
getProvisionID
(),
"scale"
,
confID
,
scaleReq
.
getScaleTargetName
(),
scaleReq
.
getNumOfInstances
());
Message
message
=
buildDeployerMessage
(
deployment
.
getProvisionID
(),
"scale"
,
confID
,
scaleReq
.
getScaleTargetName
(),
scaleReq
.
getNumOfInstances
());
message
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
message
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
try
(
DRIPCaller
deployer
=
new
DeployerCaller
(
messageBrokerHost
);)
{
try
(
DRIPCaller
deployer
=
new
DeployerCaller
(
messageBrokerHost
);)
{
logger
.
info
(
"Calling deployer"
);
Message
response
=
(
deployer
.
call
(
message
));
Message
response
=
(
deployer
.
call
(
message
));
logger
.
info
(
"Got response from deployer"
);
List
<
MessageParameter
>
params
=
response
.
getParameters
();
List
<
MessageParameter
>
params
=
response
.
getParameters
();
handleResponse
(
params
,
null
);
handleResponse
(
params
,
null
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/ProvisionService.java
View file @
3c78f488
This diff is collapsed.
Click to expand it.
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