Commit a1ff1a3a authored by Spiros Koulouzis's avatar Spiros Koulouzis

Fixed bug with getting yml string for deployer

parent 8991bf18
......@@ -213,7 +213,7 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip">
<td><span class="downloadfile-name">drip-api-php.zip</span></td>
<td><span class="downloadfile-size">3.76K</span></td>
<td><span class="downloadfile-size">3.75K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
......
......@@ -1417,65 +1417,43 @@ module V1
module Types
# (no documentation provided)
class DeployResponse < Nl::Uva::Sne::Drip::Commons::V1::Types::DeployRequest
class ToscaRepresentation < Nl::Uva::Sne::Drip::Commons::V1::Types::KeyValueHolder
# (no documentation provided)
attr_accessor :key
# the id
attr_accessor :id
# the name
attr_accessor :name
# the json hash for this DeployResponse
# the json hash for this ToscaRepresentation
def to_jaxb_json_hash
_h = super
_h['key'] = key.to_jaxb_json_hash unless key.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
_h['name'] = name.to_jaxb_json_hash unless name.nil?
return _h
end
#initializes this DeployResponse with a json hash
#initializes this ToscaRepresentation with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['key'].nil?
_oa = _o['key']
if(_oa.is_a? Hash)
@key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@key = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@key.push Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_item)
else
@key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@key = _oa
end
end
if !_o['id'].nil?
_oa = _o['id']
if !_o['name'].nil?
_oa = _o['name']
if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class']
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@id = Array.new
@name = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item)
@name.push String.from_json(_item)
else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@id = _oa
@name = _oa
end
end
end
# constructs a DeployResponse from a (parsed) JSON hash
# constructs a ToscaRepresentation from a (parsed) JSON hash
def self.from_json(o)
if o.nil?
return nil
......@@ -1516,43 +1494,65 @@ module V1
module Types
# (no documentation provided)
class ToscaRepresentation < Nl::Uva::Sne::Drip::Commons::V1::Types::KeyValueHolder
class DeployResponse < Nl::Uva::Sne::Drip::Commons::V1::Types::DeployRequest
# the name
attr_accessor :name
# (no documentation provided)
attr_accessor :key
# the id
attr_accessor :id
# the json hash for this ToscaRepresentation
# the json hash for this DeployResponse
def to_jaxb_json_hash
_h = super
_h['name'] = name.to_jaxb_json_hash unless name.nil?
_h['key'] = key.to_jaxb_json_hash unless key.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
return _h
end
#initializes this ToscaRepresentation with a json hash
#initializes this DeployResponse with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['name'].nil?
_oa = _o['name']
if !_o['key'].nil?
_oa = _o['key']
if(_oa.is_a? Hash)
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class']
@key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@name = Array.new
@key = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@name.push String.from_json(_item)
@key.push Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_item)
else
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@name = _oa
@key = _oa
end
end
if !_o['id'].nil?
_oa = _o['id']
if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@id = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item)
else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@id = _oa
end
end
end
# constructs a ToscaRepresentation from a (parsed) JSON hash
# constructs a DeployResponse from a (parsed) JSON hash
def self.from_json(o)
if o.nil?
return nil
......
......@@ -68,7 +68,7 @@
<dl class="dl-horizontal">
<dt>Subtypes</dt>
<dd><a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_Key.html">Key</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
<dd><a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_Key.html">Key</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
</dl>
<table class="table datatype-properties">
......
{
"creationDate": 1491309802500,
"parameters": [
{
"url": null,
"encoding": "UTF-8",
"value": null,
"name": "credential",
"attributes": {
"role": "master",
"IP": "52.91.133.78",
"user": "ubuntu"
}
},
{
"url": null,
"encoding": "UTF-8",
"value": null,
"name": "credential",
"attributes": {
"role": "slave",
"IP": "54.144.250.248",
"user": "ubuntu"
}
},
{
"url": null,
"encoding": "UTF-8",
"value": "ansible",
"name": "cluster",
"attributes": null
},
{
"url": null,
"encoding": "UTF-8",
"value": "'---':\n- hosts: all\n tasks:\n - name: install sysbench\n apt: name=\"{{ item }}\" update_cache=yes state=latest\n with_items: [phoronix-test-suite, sysbench, expect, git, python-pexpect, php-zip]\n become: true\n - {name: Phoronix-test-suite accept User Agreement, command: 'expect -c \"spawn phoronix-test-suite;\n expect \\\"Do you agree to these terms and wish to proceed \\(Y/n\\):\\\"; send \\\"Y\n \\\"; expect \\\"Enable anonymous usage / statistics reporting \\(Y/n\\):\\\"; send\n \\\"n \\\"; expect \\\"Enable anonymous statistical reporting of installed software\n / hardware \\(Y/n\\):\\\"; send \\\"n \\\"; interact;\"', become: true}\n - {name: Install stream, command: phoronix-test-suite install-test stream, become: true}\n - {name: Install iozone, command: phoronix-test-suite install-test iozone, become: true}\n - {name: Count vCPU, command: nproc, register: vcpunumber, become: true}\n - {debug: 'msg=\"{{ vcpunumber.stdout }}\"'}\n - {name: Run sysbench, command: 'sysbench --test=cpu --cpu-max-prime=100000 --num-threads={{\n vcpunumber.stdout }} run', register: sysbenchoutput, become: true}\n - {debug: 'msg=\"{{ sysbenchoutput.stdout }}\"'}\n - {name: Run stream, command: 'expect -c \"spawn phoronix-test-suite run-test stream;\n expect \\\"Type:\\\"; send \\\"4 \\\"; expect \\\"\\(Y/n\\):\\\"; send -- \\\"y\\r\\\"; expect\n \\\"Enter a name to save these results under:\\\"; send \\\"out \\\"; expect \\\"Enter\n a unique name to describe this test run / configuration:\\\"; send -- \\\"unique\\r\\\";\n expect \\\"New Description:\\\"; send \\\"\\r\\\"; expect \\\"Would you like to upload\n the results to OpenBenchmarking.org (Y/n):\\\"; send \\\"n\\r\\\"; interact;\"', register: streamoutput,\n become: true}\n - {debug: 'msg=\"{{ streamoutput.stdout }}\"'}\n - {name: Run iozone, command: 'expect -c \"spawn phoronix-test-suite run-test iozone;\n expect \\\"Record Size:\\\"; send \\\"2 \\\"; expect \\\"File Size:\\\"; send \\\"2 \\\"; expect\n \\\"Disk Test:\\\"; send \\\"3 \\\"; expect \\\"\\(Y/n\\):\\\"; send -- \\\"y\\r\\\"; expect \\\"Enter\n a name to save these results under:\\\"; send \\\"out \\\"; expect \\\"Enter a unique\n name to describe this test run / configuration:\\\"; send -- \\\"unique\\r\\\"; expect\n \\\"New Description:\\\"; send \\\"\\r\\\"; expect \\\"Would you like to upload the results\n to OpenBenchmarking.org (Y/n):\\\"; send \\\"n\\r\\\"; interact;\"', register: iozoneoutput,\n become: true}\n - {name: Get stream results, command: phoronix-test-suite result-file-to-csv out,\n register: streamoutput, become: true}\n - {debug: 'msg=\"{{ streamoutput.stdout }}\"'}\n",
"name": "playbook",
"attributes": null
}
]
}
......@@ -174,7 +174,7 @@ public class DeployService {
deployInvokationMessage.setCreationDate(System.currentTimeMillis());
return deployInvokationMessage;
}
@PostAuthorize("(hasRole('ROLE_ADMIN'))")
public void deleteAll() {
deployDao.deleteAll();
......@@ -214,11 +214,11 @@ public class DeployService {
}
private MessageParameter createAnsibleParameter(String configurationID) throws JSONException {
PlaybookRepresentation playbook = playbookService.findOne(configurationID);
String playbook = playbookService.get(configurationID, "yml");
MessageParameter ansibleParameter = new MessageParameter();
ansibleParameter.setName("playbook");
ansibleParameter.setEncoding("UTF-8");
ansibleParameter.setValue(Converter.map2YmlString(playbook.getKeyValue()));
ansibleParameter.setValue(playbook);
return ansibleParameter;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment