Commit a1ff1a3a authored by Spiros Koulouzis's avatar Spiros Koulouzis

Fixed bug with getting yml string for deployer

parent 8991bf18
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip"> <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-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> <td><span class="downloadfile-description">&nbsp;</span></td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -1417,65 +1417,43 @@ module V1 ...@@ -1417,65 +1417,43 @@ module V1
module Types module Types
# (no documentation provided) # (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) # the name
attr_accessor :key attr_accessor :name
# the id
attr_accessor :id
# the json hash for this DeployResponse # the json hash for this ToscaRepresentation
def to_jaxb_json_hash def to_jaxb_json_hash
_h = super _h = super
_h['key'] = key.to_jaxb_json_hash unless key.nil? _h['name'] = name.to_jaxb_json_hash unless name.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
return _h return _h
end end
#initializes this DeployResponse with a json hash #initializes this ToscaRepresentation with a json hash
def init_jaxb_json_hash(_o) def init_jaxb_json_hash(_o)
super _o super _o
if !_o['key'].nil? if !_o['name'].nil?
_oa = _o['key'] _oa = _o['name']
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(_oa.is_a? Hash) if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class'] @name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class'] @name = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array) elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar #an array(of hashes hopefully) or scalar
@id = Array.new @name = Array.new
_oa.each { | _item | _oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true) if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item) @name.push String.from_json(_item)
else else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item) @name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end end
} }
else else
@id = _oa @name = _oa
end end
end end
end end
# constructs a DeployResponse from a (parsed) JSON hash # constructs a ToscaRepresentation from a (parsed) JSON hash
def self.from_json(o) def self.from_json(o)
if o.nil? if o.nil?
return nil return nil
...@@ -1516,43 +1494,65 @@ module V1 ...@@ -1516,43 +1494,65 @@ module V1
module Types module Types
# (no documentation provided) # (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 # (no documentation provided)
attr_accessor :name 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 def to_jaxb_json_hash
_h = super _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 return _h
end end
#initializes this ToscaRepresentation with a json hash #initializes this DeployResponse with a json hash
def init_jaxb_json_hash(_o) def init_jaxb_json_hash(_o)
super _o super _o
if !_o['name'].nil? if !_o['key'].nil?
_oa = _o['name'] _oa = _o['key']
if(_oa.is_a? Hash) if(_oa.is_a? Hash)
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class'] @key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class'] @key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array) elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar #an array(of hashes hopefully) or scalar
@name = Array.new @key = Array.new
_oa.each { | _item | _oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true) 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 else
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item) @key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end end
} }
else 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 end
end end
# constructs a ToscaRepresentation from a (parsed) JSON hash # constructs a DeployResponse from a (parsed) JSON hash
def self.from_json(o) def self.from_json(o)
if o.nil? if o.nil?
return nil return nil
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Subtypes</dt> <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> </dl>
<table class="table datatype-properties"> <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
}
]
}
...@@ -214,11 +214,11 @@ public class DeployService { ...@@ -214,11 +214,11 @@ public class DeployService {
} }
private MessageParameter createAnsibleParameter(String configurationID) throws JSONException { private MessageParameter createAnsibleParameter(String configurationID) throws JSONException {
PlaybookRepresentation playbook = playbookService.findOne(configurationID); String playbook = playbookService.get(configurationID, "yml");
MessageParameter ansibleParameter = new MessageParameter(); MessageParameter ansibleParameter = new MessageParameter();
ansibleParameter.setName("playbook"); ansibleParameter.setName("playbook");
ansibleParameter.setEncoding("UTF-8"); ansibleParameter.setEncoding("UTF-8");
ansibleParameter.setValue(Converter.map2YmlString(playbook.getKeyValue())); ansibleParameter.setValue(playbook);
return ansibleParameter; 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