Commit a55f54c7 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fix yml cpus bug: for some reason we translate the cpus into double while it should be string

parent a7c8675b
......@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that
can be used to access the Web service API for this application.
......@@ -97,7 +97,7 @@
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized
to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
......@@ -121,13 +121,13 @@
</tr>
<tr class="clickable-row" data-href="drip-api-json-client-json-sources.jar">
<td><span class="downloadfile-name">drip-api-json-client-json-sources.jar</span></td>
<td><span class="downloadfile-size">14.88K</span></td>
<td><span class="downloadfile-size">14.89K</span></td>
<td><span class="downloadfile-description">The sources for the Java JSON client library.</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -155,7 +155,7 @@
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -184,13 +184,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-js.zip">
<td><span class="downloadfile-name">drip-api-js.zip</span></td>
<td><span class="downloadfile-size">5.92K</span></td>
<td><span class="downloadfile-size">6.05K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -213,13 +213,13 @@
<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">6.78K</span></td>
<td><span class="downloadfile-size">6.74K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML.
This is useful for accessing the resources that are published by this application, but only
......@@ -251,7 +251,7 @@
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON.
This is useful for accessing the REST endpoints that are published by this application, but only
......
This diff is collapsed.
......@@ -81,16 +81,16 @@ class</p>
</thead>
<tbody>
<tr>
<td> <span class="property-name">cloudDeploymentDomain</span>
<td> <span class="property-name">delta</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">end</span>
<td> <span class="property-name">start</span>
</td>
<td> <span class="datatype-reference">number
</span>
......@@ -99,7 +99,7 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">host</span>
<td> <span class="property-name">cloudDeploymentDomain</span>
</td>
<td> <span class="datatype-reference">string
</span>
......@@ -108,27 +108,27 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">start</span>
<td> <span class="property-name">host</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">vmType</span>
<td> <span class="property-name">end</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">delta</span>
<td> <span class="property-name">vmType</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
......@@ -167,12 +167,12 @@ No need to set during a POST</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-js example">{
&quot;delta&quot; : 12345,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;delta&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -69,7 +69,7 @@ class</p>
<dl class="dl-horizontal">
<dt>Subtypes</dt>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_DRIPLogRecord.html">DRIPLogRecord</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_MonitorringMessage.html">MonitorringMessage</a></dd>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_DRIPLogRecord.html">DRIPLogRecord</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_MonitorringMessage.html">MonitorringMessage</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a></dd>
</dl>
<table class="table datatype-properties">
......
......@@ -821,18 +821,18 @@ class]]>
<xs:complexContent>
<xs:extension base="ownedObject">
<xs:sequence>
<xs:element name="delta" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="end" type="xs:dateTime" minOccurs="0">
<xs:element name="delta" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="cloudDeploymentDomain" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="start" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="end" type="xs:dateTime" minOccurs="0">
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
......
......@@ -144,12 +144,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
[ {
&quot;delta&quot; : 12345,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;delta&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......@@ -514,12 +514,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;delta&quot; : 12345,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;delta&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -220,12 +220,12 @@ It is created automatically. No need to set during a POST</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-xml example">&lt;b-----&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;delta&gt;...&lt;/delta&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;cloudDeploymentDomain&gt;us-east-1&lt;/cloudDeploymentDomain&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;start&gt;...&lt;/start&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;owner&gt;user1&lt;/owner&gt;
&lt;/b-----&gt;
</pre>
......
......@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that
can be used to access the Web service API for this application.
......@@ -97,7 +97,7 @@
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized
to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
......@@ -121,13 +121,13 @@
</tr>
<tr class="clickable-row" data-href="drip-api-json-client-json-sources.jar">
<td><span class="downloadfile-name">drip-api-json-client-json-sources.jar</span></td>
<td><span class="downloadfile-size">14.88K</span></td>
<td><span class="downloadfile-size">14.89K</span></td>
<td><span class="downloadfile-description">The sources for the Java JSON client library.</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -155,7 +155,7 @@
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -184,13 +184,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-js.zip">
<td><span class="downloadfile-name">drip-api-js.zip</span></td>
<td><span class="downloadfile-size">5.92K</span></td>
<td><span class="downloadfile-size">6.05K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -213,13 +213,13 @@
<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">6.78K</span></td>
<td><span class="downloadfile-size">6.74K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML.
This is useful for accessing the resources that are published by this application, but only
......@@ -251,7 +251,7 @@
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created November 15, 2017</p>
<p class="lead">Created November 16, 2017</p>
<p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON.
This is useful for accessing the REST endpoints that are published by this application, but only
......
This diff is collapsed.
......@@ -81,7 +81,7 @@ class</p>
</thead>
<tbody>
<tr>
<td> <span class="property-name">cloudDeploymentDomain</span>
<td> <span class="property-name">vmType</span>
</td>
<td> <span class="datatype-reference">string
</span>
......@@ -90,7 +90,7 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">end</span>
<td> <span class="property-name">start</span>
</td>
<td> <span class="datatype-reference">number
</span>
......@@ -99,18 +99,18 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">delta</span>
<td> <span class="property-name">cloudDeploymentDomain</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">vmType</span>
<td> <span class="property-name">delta</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
......@@ -126,7 +126,7 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">start</span>
<td> <span class="property-name">end</span>
</td>
<td> <span class="datatype-reference">number
</span>
......@@ -167,12 +167,12 @@ No need to set during a POST</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-js example">{
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -821,12 +821,12 @@ class]]>
<xs:complexContent>
<xs:extension base="ownedObject">
<xs:sequence>
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="delta" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="end" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="cloudDeploymentDomain" type="xs:string" minOccurs="0">
......
......@@ -144,12 +144,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
[ {
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......@@ -514,12 +514,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;end&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -220,9 +220,9 @@ It is created automatically. No need to set during a POST</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-xml example">&lt;b-----&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;delta&gt;...&lt;/delta&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;cloudDeploymentDomain&gt;us-east-1&lt;/cloudDeploymentDomain&gt;
&lt;start&gt;...&lt;/start&gt;
......
......@@ -18,6 +18,9 @@ package nl.uva.sne.drip.api.service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.drip.commons.data.v1.external.ConfigurationRepresentation;
import nl.uva.sne.drip.commons.utils.Converter;
......@@ -53,8 +56,8 @@ public class ConfigurationService {
if (fromat != null && fromat.toLowerCase().equals("yml")) {
String ymlStr = Converter.map2YmlString(map);
ymlStr = ymlStr.replaceAll("\\uff0E", ".");
ymlStr = ymlStr.replaceAll("\'---':", "---");
ymlStr = cleanup(ymlStr);
return ymlStr;
}
if (fromat != null && fromat.toLowerCase().equals("json")) {
......@@ -63,9 +66,7 @@ public class ConfigurationService {
return jsonStr;
}
String ymlStr = Converter.map2YmlString(map);
ymlStr = ymlStr.replaceAll("\\uff0E", ".");
ymlStr = ymlStr.replaceAll("\'---':", "---");
ymlStr = cleanup(ymlStr);
return ymlStr;
}
......@@ -88,7 +89,7 @@ public class ConfigurationService {
@PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public ConfigurationRepresentation delete(String id) {
ConfigurationRepresentation tr = dao.findOne(id);
if(tr == null){
if (tr == null) {
throw new NotFoundException();
}
dao.delete(tr);
......@@ -126,4 +127,31 @@ public class ConfigurationService {
return t.getId();
}
private String cleanup(String ymlStr) {
ymlStr = ymlStr.replaceAll("\\uff0E", ".");
ymlStr = ymlStr.replaceAll("\'---':", "---");
Pattern p = Pattern.compile("cpus:.*,");
Matcher match = p.matcher(ymlStr);
while (match.find()) {
String line = match.group();
if (!line.contains("\"")) {
String cpusNum = line.split(":")[1];
cpusNum = cpusNum.replaceAll(",", "").trim();
ymlStr = ymlStr.replaceAll(cpusNum, "\"" + cpusNum + "\"");
}
}
p = Pattern.compile("memory:.*");
match = p.matcher(ymlStr);
while (match.find()) {
String line = match.group();
if (!line.contains("\"")) {
String memory = line.split(":")[1];
memory = memory.replaceAll("}", "").trim();
ymlStr = ymlStr.replaceAll(memory, "\"" + memory + "\"");
}
}
return ymlStr;
}
}
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