Commit eec95fe0 authored by Spiros Koulouzis's avatar Spiros Koulouzis

playbook is executed but we have a null exception in the response

parent 842ff7bc
...@@ -69,7 +69,7 @@ class</p> ...@@ -69,7 +69,7 @@ class</p>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Subtypes</dt> <dt>Subtypes</dt>
<dd><a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_KeyPair.html">KeyPair</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd> <dd><a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyPair.html">KeyPair</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_Script.html">Script</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
</dl> </dl>
<table class="table datatype-properties"> <table class="table datatype-properties">
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package nl.uva.sne.drip.api.service; package nl.uva.sne.drip.api.service;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -47,6 +48,7 @@ import org.springframework.stereotype.Service; ...@@ -47,6 +48,7 @@ import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.dao.DeployDao; import nl.uva.sne.drip.api.dao.DeployDao;
import nl.uva.sne.drip.api.dao.KeyPairDao; import nl.uva.sne.drip.api.dao.KeyPairDao;
import nl.uva.sne.drip.api.exception.KeyException; import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.commons.utils.MessageGenerator;
import nl.uva.sne.drip.data.v1.external.KeyPair; import nl.uva.sne.drip.data.v1.external.KeyPair;
/** /**
...@@ -113,12 +115,12 @@ public class DeployService { ...@@ -113,12 +115,12 @@ public class DeployService {
deployInfo.getManagerType().toLowerCase(), deployInfo.getManagerType().toLowerCase(),
deployInfo.getConfigurationID()); deployInfo.getConfigurationID());
Message deployerInvokationMessage = MessageGenerator.generateArtificialMessage(System.getProperty("user.home") Message response = MessageGenerator.generateArtificialMessage(System.getProperty("user.home")
+ 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_invocation.json"); + File.separator + "deployer_ansible_response2.json");
Message response = (deployer.call(deployerInvokationMessage)); // Message response = (deployer.call(deployerInvokationMessage));
// Message response = generateFakeResponse(); // Message response = generateFakeResponse();
List<MessageParameter> params = response.getParameters(); List<MessageParameter> params = response.getParameters();
DeployResponse deployResponse = new DeployResponse(); DeployResponse deployResponse = new DeployResponse();
......
...@@ -49,6 +49,14 @@ public class MessageGenerator { ...@@ -49,6 +49,14 @@ public class MessageGenerator {
// + "type: Switch.nodes.Compute\\n nodetype: t2.medium\\n OStype: Ubuntu 16.04\\n domain: ec2.us-east-1.amazonaws.com\\n script: /tmp/Input-4007028381500/guiscipt.sh\\n installation: null\\n role: slave\\n dockers: mogswitch/ProxyTranscoder\\n public_address: 34.207.254.160\\n instanceId: i-0a99ea18fcc77ed7a\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"54.144.0.91 ubuntu /tmp/Input-4007028381500/Virginia.pem master\\n34.207.254.160 ubuntu /tmp/Input-4007028381500/Virginia.pem slave\\n\"}]}"; // + "type: Switch.nodes.Compute\\n nodetype: t2.medium\\n OStype: Ubuntu 16.04\\n domain: ec2.us-east-1.amazonaws.com\\n script: /tmp/Input-4007028381500/guiscipt.sh\\n installation: null\\n role: slave\\n dockers: mogswitch/ProxyTranscoder\\n public_address: 34.207.254.160\\n instanceId: i-0a99ea18fcc77ed7a\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"54.144.0.91 ubuntu /tmp/Input-4007028381500/Virginia.pem master\\n34.207.254.160 ubuntu /tmp/Input-4007028381500/Virginia.pem slave\\n\"}]}";
// String strResponse = "{\"creationDate\":1488805337447,\"parameters\":[{\"name\":\"2e5dafb6-5a1c-4a66-9dca-5841f99ea735\",\"encoding\":\"UTF-8\",\"value\":\"publicKeyPath: /tmp/Input-11594765342486/user.pem\\nuserName: zh9314\\nsubnets:\\n- {name: s1, subnet: 192.168.10.0, netmask: 255.255.255.0}\\ncomponents:\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: master\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.10}\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: slave\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem master\\n34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem slave\\n\"}]}"; // String strResponse = "{\"creationDate\":1488805337447,\"parameters\":[{\"name\":\"2e5dafb6-5a1c-4a66-9dca-5841f99ea735\",\"encoding\":\"UTF-8\",\"value\":\"publicKeyPath: /tmp/Input-11594765342486/user.pem\\nuserName: zh9314\\nsubnets:\\n- {name: s1, subnet: 192.168.10.0, netmask: 255.255.255.0}\\ncomponents:\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: master\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.10}\\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\\n type: Switch.nodes.Compute\\n nodeType: t2.medium\\n OStype: Ubuntu 16.04\\n script: /tmp/Input-11594765342486/guiscipt.sh\\n domain: ec2.us-east-1.amazonaws.com\\n installation: null\\n clusterType: swarm\\n role: slave\\n dockers: mogswitch/ProxyTranscoder:1.0\\n public_address: 34.207.73.18\\n instanceId: i-0e82b5624a0df99b1\\n ethernet_port:\\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\\n\"},{\"name\":\"kubernetes\",\"encoding\":\"UTF-8\",\"value\":\"34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem master\\n34.207.73.18 ubuntu /tmp/Input-11594765342486/Virginia.pem slave\\n\"}]}";
String strResponse = FileUtils.readFileToString(new File(path)); String strResponse = FileUtils.readFileToString(new File(path));
if (strResponse.contains("'null'")) {
strResponse = strResponse.replaceAll("'null'", "null").replaceAll("\'", "\"").replaceAll(" ", "");
}
if (strResponse.contains("\"value\":{\"")) {
return Converter.string2Message(strResponse);
}
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
......
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAm6AALYxkJFNzD3bfVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm
eNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY
Rx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri
d4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6
D3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr
N1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk
nLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq
KQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH
gG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC
ycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBm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QKBgAcDFai7rgNjJ8YcCRKxyFcMM9LKPl6hr4XFtWKzTAQPEABUkkuN
9gVClsg9f+VRKRECOIf0Ae1UWeCFEwxUXp4wjfHrzkTDVztKvmbWdvSXorDwKrZ7SC7tZpVFSfly
xuuLjadpUZT9YFmbAfY1X5oSccOMYqORjRbxEB3svb4BAoGAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ
hLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mPJxY9ICaY
55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48howjUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=
-----END RSA PRIVATE KEY-----
---
- hosts: all
tasks:
- name: install sysbench
apt: name="{{ item }}" update_cache=yes state=latest
with_items: [phoronix-test-suite, sysbench, expect, git, python-pexpect, php-zip]
become: true
- {name: Phoronix-test-suite accept User Agreement, command: 'expect -c "spawn phoronix-test-suite;
expect \"Do you agree to these terms and wish to proceed \(Y/n\):\"; send \"Y
\"; expect \"Enable anonymous usage / statistics reporting \(Y/n\):\"; send
\"n \"; expect \"Enable anonymous statistical reporting of installed software
/ hardware \(Y/n\):\"; send \"n \"; interact;"', become: true}
- {name: Install stream, command: phoronix-test-suite install-test stream, become: true}
- {name: Install iozone, command: phoronix-test-suite install-test iozone, become: true}
- {name: Count vCPU, command: nproc, register: vcpunumber, become: true}
- {debug: 'msg="{{ vcpunumber.stdout }}"'}
- {name: Run sysbench, command: 'sysbench --test=cpu --cpu-max-prime=100000 --num-threads={{
vcpunumber.stdout }} run', register: sysbenchoutput, become: true}
- {debug: 'msg="{{ sysbenchoutput.stdout }}"'}
- {name: Run stream, command: 'expect -c "spawn phoronix-test-suite run-test stream;
expect \"Type:\"; send \"4 \"; expect \"\(Y/n\):\"; send -- \"y\r\"; expect
\"Enter a name to save these results under:\"; send \"out \"; expect \"Enter
a unique name to describe this test run / configuration:\"; send -- \"unique\r\";
expect \"New Description:\"; send \"\r\"; expect \"Would you like to upload
the results to OpenBenchmarking.org (Y/n):\"; send \"n\r\"; interact;"', register: streamoutput,
become: true}
- {debug: 'msg="{{ streamoutput.stdout }}"'}
- {name: Run iozone, command: 'expect -c "spawn phoronix-test-suite run-test iozone;
expect \"Record Size:\"; send \"2 \"; expect \"File Size:\"; send \"2 \"; expect
\"Disk Test:\"; send \"3 \"; expect \"\(Y/n\):\"; send -- \"y\r\"; expect \"Enter
a name to save these results under:\"; send \"out \"; expect \"Enter a unique
name to describe this test run / configuration:\"; send -- \"unique\r\"; expect
\"New Description:\"; send \"\r\"; expect \"Would you like to upload the results
to OpenBenchmarking.org (Y/n):\"; send \"n\r\"; interact;"', register: iozoneoutput,
become: true}
- {name: Get stream results, command: phoronix-test-suite result-file-to-csv out,
register: streamoutput, become: true}
- {debug: 'msg="{{ streamoutput.stdout }}"'}
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