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
cff8a3c0
Commit
cff8a3c0
authored
Apr 21, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented ansible output
parent
17993265
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
501 additions
and
16 deletions
+501
-16
enunciate.xml
drip-api/enunciate.xml
+1
-0
DRIPCaller.java
...api/src/main/java/nl/uva/sne/drip/api/rpc/DRIPCaller.java
+0
-5
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+12
-2
DeployResponse.java
...java/nl/uva/sne/drip/data/v1/external/DeployResponse.java
+21
-8
KeyPair.java
...c/main/java/nl/uva/sne/drip/data/v1/external/KeyPair.java
+3
-1
AnsibleOutput.java
.../uva/sne/drip/data/v1/external/ansible/AnsibleOutput.java
+40
-0
AnsibleResult.java
.../uva/sne/drip/data/v1/external/ansible/AnsibleResult.java
+241
-0
Invocation.java
.../nl/uva/sne/drip/data/v1/external/ansible/Invocation.java
+46
-0
Result_.java
...ava/nl/uva/sne/drip/data/v1/external/ansible/Result_.java
+137
-0
No files found.
drip-api/enunciate.xml
View file @
cff8a3c0
...
...
@@ -10,6 +10,7 @@
<include
pattern=
"nl.uva.sne.drip.api.v1.rest.*"
/>
<include
pattern=
"nl.uva.sne.drip.api.v0.rest.*"
/>
<include
pattern=
"nl.uva.sne.drip.data.v1.external.*"
/>
<include
pattern=
"nl.uva.sne.drip.data.v1.external.ansible.*"
/>
<include
pattern=
"nl.uva.sne.drip.data.v0.external.*"
/>
<exclude
pattern=
"nl.uva.sne.drip.data.internal.*"
/>
</api-classes>
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/rpc/DRIPCaller.java
View file @
cff8a3c0
...
...
@@ -9,8 +9,6 @@ import com.rabbitmq.client.ConnectionFactory;
import
com.rabbitmq.client.DefaultConsumer
;
import
com.rabbitmq.client.Envelope
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
...
...
@@ -18,11 +16,8 @@ import java.util.concurrent.TimeoutException;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.data.v1.external.Message
;
import
nl.uva.sne.drip.data.v1.external.MessageParameter
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
cff8a3c0
...
...
@@ -15,6 +15,8 @@
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
service
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -48,6 +50,7 @@ import nl.uva.sne.drip.api.dao.DeployDao;
import
nl.uva.sne.drip.api.dao.KeyPairDao
;
import
nl.uva.sne.drip.api.exception.KeyException
;
import
nl.uva.sne.drip.data.v1.external.KeyPair
;
import
nl.uva.sne.drip.data.v1.external.ansible.Output
;
/**
*
...
...
@@ -210,12 +213,12 @@ public class DeployService {
return
ansibleParameter
;
}
private
DeployResponse
handleResponse
(
List
<
MessageParameter
>
params
)
throws
KeyException
{
private
DeployResponse
handleResponse
(
List
<
MessageParameter
>
params
)
throws
KeyException
,
IOException
{
DeployResponse
deployResponse
=
new
DeployResponse
();
for
(
MessageParameter
p
:
params
)
{
String
name
=
p
.
getName
();
System
.
err
.
println
(
name
+
" : "
+
p
.
getValue
());
if
(
name
.
equals
(
"credential"
))
{
String
value
=
p
.
getValue
();
Key
k
=
new
Key
();
...
...
@@ -224,9 +227,16 @@ public class DeployService {
KeyPair
pair
=
new
KeyPair
();
pair
.
setPrivateKey
(
k
);
deployResponse
.
setKey
(
pair
);
save
(
deployResponse
);
return
deployResponse
;
}
if
(
name
.
equals
(
"ansible_output"
))
{
String
value
=
p
.
getValue
();
ObjectMapper
mapper
=
new
ObjectMapper
();
System
.
err
.
println
(
value
);
List
<
Output
>
outputList
=
mapper
.
readValue
(
value
,
new
TypeReference
<
List
<
Output
>>()
{
});
deployResponse
.
setAnsibleOutputList
(
outputList
);
}
}
save
(
deployResponse
);
...
...
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/DeployResponse.java
View file @
cff8a3c0
...
...
@@ -15,31 +15,44 @@
*/
package
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
;
import
com.webcohesion.enunciate.metadata.DocumentationExample
;
import
org.springframework.data.annotation.Id
;
import
nl.uva.sne.drip.data.v1.external.ansible.Output
;
import
java.util.List
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* This class represents the response of a deploy request. It may hold a key
* pair used for logging in and managing a docker cluster. Currently they key
* This class represents the response of a deploy request. It may hold a key
* pair used for logging in and managing a docker cluster. Currently they key
* pair is only used by kubernetes
*
*
* @author S. Koulouzis
*/
@Document
public
class
DeployResponse
extends
DeployRequest
{
private
KeyPair
key
;
private
List
<
Output
>
ansibleOutputList
;
public
void
setAnsibleOutputList
(
List
<
Output
>
outputList
)
{
this
.
ansibleOutputList
=
outputList
;
}
/**
* @return the ansibleOutputList
*/
public
List
<
Output
>
getAnsibleOutputList
()
{
return
ansibleOutputList
;
}
public
void
setKey
(
KeyPair
key
)
{
this
.
key
=
key
;
}
/**
* The key pair to log in and manage a docker cluster
* @return
*
* @return
*/
public
KeyPair
getKeyPair
()
{
return
key
;
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/KeyPair.java
View file @
cff8a3c0
...
...
@@ -15,16 +15,18 @@
*/
package
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
nl.uva.sne.drip.api.exception.KeyException
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* This class hold the pair of public private keys. The k
ye
s may be used for
* This class hold the pair of public private keys. The k
ey
s may be used for
* logging in VMs.
*
* @author S. Koulouzis
*/
@Document
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
KeyPair
extends
OwnedObject
{
private
Key
privateKey
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/AnsibleOutput.java
0 → 100644
View file @
cff8a3c0
package
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
.
ansible
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonPropertyOrder
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonPropertyOrder
({
"host"
,
"result"
})
public
class
AnsibleOutput
{
@JsonProperty
(
"host"
)
private
String
host
;
@JsonProperty
(
"result"
)
private
AnsibleResult
result
;
@JsonProperty
(
"host"
)
public
String
getHost
()
{
return
host
;
}
@JsonProperty
(
"host"
)
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
@JsonProperty
(
"result"
)
public
AnsibleResult
getResult
()
{
return
result
;
}
@JsonProperty
(
"result"
)
public
void
setResult
(
AnsibleResult
result
)
{
this
.
result
=
result
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/AnsibleResult.java
0 → 100644
View file @
cff8a3c0
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* 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
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
.
ansible
;
/**
*
* @author S. Koulouzis
*/
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Date
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AnsibleResult
{
@JsonProperty
(
"_ansible_parsed"
)
private
Boolean
ansibleParsed
;
@JsonProperty
(
"changed"
)
private
Boolean
changed
;
@JsonProperty
(
"results"
)
private
List
<
Result_
>
results
=
null
;
@JsonProperty
(
"_ansible_verbose_always"
)
private
Boolean
ansible_verbose_always
;
@JsonProperty
(
"end"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss.SSSSSS"
)
private
Date
end
;
@JsonProperty
(
"_ansible_no_log"
)
private
Boolean
ansibleNoLog
;
@JsonProperty
(
"stdout"
)
private
String
stdout
;
@JsonProperty
(
"msg"
)
private
String
msg
;
@JsonProperty
(
"cmd"
)
private
List
<
String
>
cmd
=
null
;
@JsonProperty
(
"rc"
)
private
Integer
rc
;
@JsonProperty
(
"start"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss.SSSSSS"
)
private
Date
start
;
@JsonProperty
(
"stderr"
)
private
String
stderr
;
@JsonProperty
(
"delta"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"HH:mm:ss.SSSSSS"
)
private
Date
delta
;
@JsonProperty
(
"invocation"
)
private
Invocation
invocation
;
@JsonProperty
(
"stdout_lines"
)
private
List
<
String
>
stdoutLines
=
null
;
@JsonProperty
(
"warnings"
)
private
List
<
String
>
warnings
=
null
;
@JsonProperty
(
"_ansible_parsed"
)
public
Boolean
getAnsibleParsed
()
{
return
ansibleParsed
;
}
@JsonProperty
(
"_ansible_parsed"
)
public
void
setAnsibleParsed
(
Boolean
ansibleParsed
)
{
this
.
ansibleParsed
=
ansibleParsed
;
}
@JsonProperty
(
"_ansible_verbose_always"
)
public
Boolean
getAnsibleVerboseAlways
()
{
return
ansible_verbose_always
;
}
@JsonProperty
(
"_ansible_verbose_always"
)
public
void
setAnsibleVerboseAlways
(
Boolean
ansible_verbose_always
)
{
this
.
ansible_verbose_always
=
ansible_verbose_always
;
}
@JsonProperty
(
"changed"
)
public
Boolean
getChanged
()
{
return
changed
;
}
@JsonProperty
(
"changed"
)
public
void
setChanged
(
Boolean
changed
)
{
this
.
changed
=
changed
;
}
@JsonProperty
(
"_ansible_verbose_always"
)
public
Boolean
getAnsible_verbose_always
()
{
return
changed
;
}
@JsonProperty
(
"_ansible_verbose_always"
)
public
void
setAnsible_verbose_always
(
Boolean
_ansible_verbose_always
)
{
this
.
ansible_verbose_always
=
_ansible_verbose_always
;
}
@JsonProperty
(
"end"
)
public
Date
getEnd
()
{
return
end
;
}
@JsonProperty
(
"end"
)
public
void
setEnd
(
Date
end
)
{
this
.
end
=
end
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
Boolean
getAnsibleNoLog
()
{
return
ansibleNoLog
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
void
setAnsibleNoLog
(
Boolean
ansibleNoLog
)
{
this
.
ansibleNoLog
=
ansibleNoLog
;
}
@JsonProperty
(
"stdout"
)
public
String
getStdout
()
{
return
stdout
;
}
@JsonProperty
(
"stdout"
)
public
void
setStdout
(
String
stdout
)
{
this
.
stdout
=
stdout
;
}
@JsonProperty
(
"msg"
)
public
String
getMsg
()
{
return
msg
;
}
@JsonProperty
(
"msg"
)
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
@JsonProperty
(
"cmd"
)
public
List
<
String
>
getCmd
()
{
return
cmd
;
}
@JsonProperty
(
"cmd"
)
public
void
setCmd
(
List
<
String
>
cmd
)
{
this
.
cmd
=
cmd
;
}
@JsonProperty
(
"rc"
)
public
Integer
getRc
()
{
return
rc
;
}
@JsonProperty
(
"rc"
)
public
void
setRc
(
Integer
rc
)
{
this
.
rc
=
rc
;
}
@JsonProperty
(
"start"
)
public
Date
getStart
()
{
return
start
;
}
@JsonProperty
(
"start"
)
public
void
setStart
(
Date
start
)
{
this
.
start
=
start
;
}
@JsonProperty
(
"stderr"
)
public
String
getStderr
()
{
return
stderr
;
}
@JsonProperty
(
"stderr"
)
public
void
setStderr
(
String
stderr
)
{
this
.
stderr
=
stderr
;
}
@JsonProperty
(
"delta"
)
public
Date
getDelta
()
{
return
delta
;
}
@JsonProperty
(
"delta"
)
public
void
setDelta
(
Date
delta
)
{
this
.
delta
=
delta
;
}
@JsonProperty
(
"invocation"
)
public
Invocation
getInvocation
()
{
return
invocation
;
}
@JsonProperty
(
"invocation"
)
public
void
setInvocation
(
Invocation
invocation
)
{
this
.
invocation
=
invocation
;
}
@JsonProperty
(
"stdout_lines"
)
public
List
<
String
>
getStdoutLines
()
{
return
stdoutLines
;
}
@JsonProperty
(
"stdout_lines"
)
public
void
setStdoutLines
(
List
<
String
>
stdoutLines
)
{
this
.
stdoutLines
=
stdoutLines
;
}
@JsonProperty
(
"warnings"
)
public
List
<
String
>
getWarnings
()
{
return
warnings
;
}
@JsonProperty
(
"warnings"
)
public
void
setWarnings
(
List
<
String
>
warnings
)
{
this
.
warnings
=
warnings
;
}
@JsonProperty
(
"results"
)
public
List
<
Result_
>
getResults
()
{
return
results
;
}
@JsonProperty
(
"results"
)
public
void
setResults
(
List
<
Result_
>
results
)
{
this
.
results
=
results
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/Invocation.java
0 → 100644
View file @
cff8a3c0
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* 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
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
.
ansible
;
/**
*
* @author S. Koulouzis
*/
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
Invocation
{
@JsonProperty
(
"module_name"
)
private
String
moduleName
;
@JsonIgnore
@JsonProperty
(
"module_args"
)
private
Object
moduleArgs
;
@JsonProperty
(
"module_name"
)
public
String
getModuleName
()
{
return
moduleName
;
}
@JsonProperty
(
"module_name"
)
public
void
setModuleName
(
String
moduleName
)
{
this
.
moduleName
=
moduleName
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/data/v1/external/ansible/Result_.java
0 → 100644
View file @
cff8a3c0
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* 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
nl
.
uva
.
sne
.
drip
.
data
.
v1
.
external
.
ansible
;
/**
*
* @author S. Koulouzis
*/
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonPropertyOrder
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonPropertyOrder
({
"_ansible_parsed"
,
"changed"
,
"_ansible_no_log"
,
"cache_updated"
,
"_ansible_item_result"
,
"item"
,
"invocation"
,
"cache_update_time"
})
public
class
Result_
{
@JsonProperty
(
"_ansible_parsed"
)
private
Boolean
ansibleParsed
;
@JsonProperty
(
"changed"
)
private
Boolean
changed
;
@JsonProperty
(
"_ansible_no_log"
)
private
Boolean
ansibleNoLog
;
@JsonProperty
(
"cache_updated"
)
private
Boolean
cacheUpdated
;
@JsonProperty
(
"_ansible_item_result"
)
private
Boolean
ansibleItemResult
;
@JsonProperty
(
"item"
)
private
List
<
String
>
item
=
null
;
@JsonProperty
(
"invocation"
)
private
Invocation
invocation
;
@JsonProperty
(
"cache_update_time"
)
private
Integer
cacheUpdateTime
;
@JsonProperty
(
"_ansible_parsed"
)
public
Boolean
getAnsibleParsed
()
{
return
ansibleParsed
;
}
@JsonProperty
(
"_ansible_parsed"
)
public
void
setAnsibleParsed
(
Boolean
ansibleParsed
)
{
this
.
ansibleParsed
=
ansibleParsed
;
}
@JsonProperty
(
"changed"
)
public
Boolean
getChanged
()
{
return
changed
;
}
@JsonProperty
(
"changed"
)
public
void
setChanged
(
Boolean
changed
)
{
this
.
changed
=
changed
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
Boolean
getAnsibleNoLog
()
{
return
ansibleNoLog
;
}
@JsonProperty
(
"_ansible_no_log"
)
public
void
setAnsibleNoLog
(
Boolean
ansibleNoLog
)
{
this
.
ansibleNoLog
=
ansibleNoLog
;
}
@JsonProperty
(
"cache_updated"
)
public
Boolean
getCacheUpdated
()
{
return
cacheUpdated
;
}
@JsonProperty
(
"cache_updated"
)
public
void
setCacheUpdated
(
Boolean
cacheUpdated
)
{
this
.
cacheUpdated
=
cacheUpdated
;
}
@JsonProperty
(
"_ansible_item_result"
)
public
Boolean
getAnsibleItemResult
()
{
return
ansibleItemResult
;
}
@JsonProperty
(
"_ansible_item_result"
)
public
void
setAnsibleItemResult
(
Boolean
ansibleItemResult
)
{
this
.
ansibleItemResult
=
ansibleItemResult
;
}
@JsonProperty
(
"item"
)
public
List
<
String
>
getItem
()
{
return
item
;
}
@JsonProperty
(
"item"
)
public
void
setItem
(
List
<
String
>
item
)
{
this
.
item
=
item
;
}
@JsonProperty
(
"invocation"
)
public
Invocation
getInvocation
()
{
return
invocation
;
}
@JsonProperty
(
"invocation"
)
public
void
setInvocation
(
Invocation
invocation
)
{
this
.
invocation
=
invocation
;
}
@JsonProperty
(
"cache_update_time"
)
public
Integer
getCacheUpdateTime
()
{
return
cacheUpdateTime
;
}
@JsonProperty
(
"cache_update_time"
)
public
void
setCacheUpdateTime
(
Integer
cacheUpdateTime
)
{
this
.
cacheUpdateTime
=
cacheUpdateTime
;
}
}
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