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
d17647f0
Commit
d17647f0
authored
Nov 21, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ansible bugs: set correct name for deployer and fix deployer ansible logging
parent
a55f54c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
ConfigurationService.java
...ava/nl/uva/sne/drip/api/service/ConfigurationService.java
+6
-5
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+7
-5
MonitorringMessageController.java
...va/sne/drip/api/v1/rest/MonitorringMessageController.java
+3
-2
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/ConfigurationService.java
View file @
d17647f0
...
@@ -135,23 +135,24 @@ public class ConfigurationService {
...
@@ -135,23 +135,24 @@ public class ConfigurationService {
Matcher
match
=
p
.
matcher
(
ymlStr
);
Matcher
match
=
p
.
matcher
(
ymlStr
);
while
(
match
.
find
())
{
while
(
match
.
find
())
{
String
line
=
match
.
group
();
String
line
=
match
.
group
();
if
(!
line
.
contains
(
"\""
))
{
if
(!
line
.
contains
(
"\""
)
||
line
.
contains
(
"'"
)
)
{
String
cpusNum
=
line
.
split
(
":"
)[
1
];
String
cpusNum
=
line
.
split
(
":"
)[
1
];
cpusNum
=
cpusNum
.
replaceAll
(
","
,
""
).
trim
();
cpusNum
=
cpusNum
.
replaceAll
(
","
,
""
).
trim
();
ymlStr
=
ymlStr
.
replaceAll
(
cpusNum
,
"\""
+
cpusNum
+
"\""
);
ymlStr
=
ymlStr
.
replaceAll
(
cpusNum
,
'\''
+
cpusNum
+
'\''
);
}
}
}
}
p
=
Pattern
.
compile
(
"memory:.*"
);
p
=
Pattern
.
compile
(
"memory:.*"
);
match
=
p
.
matcher
(
ymlStr
);
match
=
p
.
matcher
(
ymlStr
);
while
(
match
.
find
())
{
while
(
match
.
find
())
{
String
line
=
match
.
group
();
String
line
=
match
.
group
();
if
(!
line
.
contains
(
"\""
))
{
if
(!
line
.
contains
(
"\""
)
||
line
.
contains
(
"'"
)
)
{
String
memory
=
line
.
split
(
":"
)[
1
];
String
memory
=
line
.
split
(
":"
)[
1
];
memory
=
memory
.
replaceAll
(
"}"
,
""
).
trim
();
memory
=
memory
.
replaceAll
(
"}"
,
""
).
trim
();
ymlStr
=
ymlStr
.
replaceAll
(
memory
,
"\""
+
memory
+
"\""
);
ymlStr
=
ymlStr
.
replaceAll
(
memory
,
'\''
+
memory
+
'\''
);
}
}
}
}
return
ymlStr
;
return
ymlStr
.
replaceAll
(
"'''"
,
"'"
);
}
}
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
d17647f0
...
@@ -145,10 +145,7 @@ public class DeployService {
...
@@ -145,10 +145,7 @@ public class DeployService {
null
).
get
(
0
);
null
).
get
(
0
);
;
;
deployerInvokationMessage
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
deployerInvokationMessage
.
setOwner
(((
User
)
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
()).
getUsername
());
// Message response = MessageGenerator.generate ArtificialMessage(System.getProperty("user.home")
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "deployer_ansible_response_benchmark.json");
logger
.
info
(
"Calling deployer"
);
logger
.
info
(
"Calling deployer"
);
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
Message
response
=
(
deployer
.
call
(
deployerInvokationMessage
));
logger
.
info
(
"Got response from deployer"
);
logger
.
info
(
"Got response from deployer"
);
...
@@ -292,7 +289,12 @@ public class DeployService {
...
@@ -292,7 +289,12 @@ public class DeployService {
private
MessageParameter
createConfigurationParameter
(
String
configurationID
,
String
confType
)
throws
JSONException
{
private
MessageParameter
createConfigurationParameter
(
String
configurationID
,
String
confType
)
throws
JSONException
{
String
configuration
=
configurationService
.
get
(
configurationID
,
"yml"
);
String
configuration
=
configurationService
.
get
(
configurationID
,
"yml"
);
MessageParameter
configurationParameter
=
new
MessageParameter
();
MessageParameter
configurationParameter
=
new
MessageParameter
();
configurationParameter
.
setName
(
confType
);
if
(
confType
.
equals
(
"ansible"
))
{
configurationParameter
.
setName
(
"playbook"
);
}
else
{
configurationParameter
.
setName
(
confType
);
}
configurationParameter
.
setEncoding
(
"UTF-8"
);
configurationParameter
.
setEncoding
(
"UTF-8"
);
configurationParameter
.
setValue
(
configuration
);
configurationParameter
.
setValue
(
configuration
);
return
configurationParameter
;
return
configurationParameter
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/MonitorringMessageController.java
View file @
d17647f0
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
v1
.
rest
;
package
nl
.
uva
.
sne
.
drip
.
api
.
v1
.
rest
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.GrafanaMonitorringMessage
;
import
com.webcohesion.enunciate.metadata.rs.ResponseCode
;
import
com.webcohesion.enunciate.metadata.rs.ResponseCode
;
import
com.webcohesion.enunciate.metadata.rs.StatusCodes
;
import
com.webcohesion.enunciate.metadata.rs.StatusCodes
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -53,8 +54,8 @@ public class MonitorringMessageController {
...
@@ -53,8 +54,8 @@ public class MonitorringMessageController {
public
@ResponseBody
public
@ResponseBody
String
post
(
@RequestBody
MonitorringMessage
message
)
{
String
post
(
@RequestBody
MonitorringMessage
message
)
{
return
monitorringMessageService
.
save
(
message
).
getId
();
return
monitorringMessageService
.
save
(
message
).
getId
();
}
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
public
@ResponseBody
...
...
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