diff --git a/app/__init__.py b/app/__init__.py
index 68e8330c2..dfd525547 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -1004,9 +1004,9 @@ def createdep():
if "public" in site["networks"][vo]:
pub_network_id = site["networks"][vo]["public"]
- if form_data['extra_opts.selectedImage'] != "" and 'name' in site:
+ if form_data.get('extra_opts.selectedImage', "") != "" and 'name' in site:
image = "appdb://%s/%s?%s" % (site['name'], form_data['extra_opts.selectedImage'], vo)
- elif form_data['extra_opts.selectedSiteImage'] != "":
+ elif form_data.get('extra_opts.selectedSiteImage', "") != "":
image = form_data['extra_opts.selectedSiteImage']
else:
image_id = form_data['extra_opts.imageID']
@@ -1432,7 +1432,7 @@ def write_ssh_key():
key = request.form['sshkey']
desc = request.form['desc']
- if key == "" or str(SSHKey.check_ssh_key(key.encode())) != "0":
+ if key == "" or not SSHKey.check_ssh_key(key):
flash("Invaild SSH public key. Please insert a correct one.", 'warning')
return redirect(url_for('get_ssh_keys'))
diff --git a/app/ssh_key.py b/app/ssh_key.py
index 2e5e37b89..d86dff7b7 100644
--- a/app/ssh_key.py
+++ b/app/ssh_key.py
@@ -19,9 +19,7 @@
# specific language governing permissions and limitations
# under the License.
"""Class to manage user SSH key using a DB backend."""
-import base64
-import binascii
-import struct
+import paramiko
from app.db import DataBase
@@ -78,33 +76,8 @@ def delete_ssh_key(self, userid, keyid):
@staticmethod
def check_ssh_key(key):
- # credits to: https://gist.github.com/piyushbansal/5243418
-
- array = key.split()
-
- # Each rsa-ssh key has 2 or 3 different strings in it, first one being
- # typeofkey second one being keystring third one being username (optional).
- if len(array) not in [2, 3]:
- return 1
-
- typeofkey = array[0]
- string = array[1]
-
- # must have only valid rsa-ssh key characters ie binascii characters
try:
- data = base64.decodebytes(string)
- except binascii.Error:
- return 1
-
- a = 4
- # unpack the contents of data, from data[:4] , it must be equal to 7 , property of ssh key .
- try:
- str_len = struct.unpack('>I', data[:a])[0]
- except struct.error:
- return 1
-
- # data[4:11] must have string which matches with the typeofkey , another ssh key property.
- if data[a:a + str_len] == typeofkey and int(str_len) == int(7):
- return 0
- else:
- return 1
+ paramiko.PublicBlob.from_string(key)
+ except Exception:
+ return False
+ return True
diff --git a/app/static/images/ARC.png b/app/static/images/ARC.png
new file mode 100644
index 000000000..e7c3f25db
Binary files /dev/null and b/app/static/images/ARC.png differ
diff --git a/app/templates/advanced_config.html b/app/templates/advanced_config.html
index 15c361d3e..10d5375ed 100644
--- a/app/templates/advanced_config.html
+++ b/app/templates/advanced_config.html
@@ -130,6 +130,8 @@
Cloud Provider:
$('#siteImages').hide();
$('#fedcloudUsage').hide();
}
+ $("#selectedImage").prop('disabled', false);
+ $("#selectedSiteImage").prop('disabled', false);
}
function loadImages() {
@@ -209,6 +211,28 @@ Cloud Provider:
});
}
+ function selectedSiteImageChanged() {
+ // disable the other select of AppDB images
+ var selected = $("#selectedSiteImage option:selected" ).text();
+ if (selected == " - Select one image - ") {
+ $("#selectedImage").prop('disabled', false);
+ } else {
+ $("#selectedImage").prop('disabled', true);
+ }
+ activateSubmit()
+ }
+
+ function selectedImageChanged() {
+ // disable the other select of site images
+ var selected = $("#selectedImage option:selected" ).text();
+ if (selected == " - Select one image - ") {
+ $("#selectedSiteImage").prop('disabled', false);
+ } else {
+ $("#selectedSiteImage").prop('disabled', true);
+ }
+ activateSubmit()
+ }
+
function activateSubmit() {
$(".submitBtn").attr("disabled", false);
}
@@ -252,7 +276,7 @@ Cloud Provider:
-