-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
FROM grycap/jenkins:ubuntu16.04-im | ||
ARG BRANCH=devel | ||
MAINTAINER Miguel Caballer <[email protected]> | ||
LABEL version="1.6.5" | ||
LABEL version="1.6.6" | ||
LABEL description="Container image to run the IM service. (http://www.grycap.upv.es/im)" | ||
|
||
EXPOSE 8899 8800 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Dockerfile to create a container with the IM service | ||
FROM ubuntu:16.04 | ||
LABEL maintainer="Miguel Caballer <[email protected]>" | ||
LABEL version="1.6.5" | ||
LABEL version="1.6.6" | ||
LABEL description="Container image to run the IM service. (http://www.grycap.upv.es/im)" | ||
EXPOSE 8899 8800 | ||
|
||
|
@@ -18,7 +18,7 @@ RUN pip install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-co | |
RUN apt-get update && apt-get install --no-install-recommends -y gcc libmysqld-dev libssl-dev libffi-dev libsqlite3-dev && \ | ||
pip install MySQL-python && \ | ||
pip install xmltodict && \ | ||
pip install IM==1.6.5 && \ | ||
pip install IM==1.6.6 && \ | ||
apt-get remove -y gcc libmysqld-dev libssl-dev libffi-dev libsqlite3-dev python-dev python-pip && \ | ||
apt-get autoremove -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type = InfrastructureManager; username = someurser; password = somepass | ||
type = VMRC; host = http://server:8080/vmrc/vmrc; username = user; password = pass | ||
id = one2; type = OpenNebula; host = server1.com:2633; username = user; password = pass | ||
id = occi; type = OCCI; proxy = file(/tmp/privatekey.pem); host = https://server.com:11443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#! /usr/bin/env python | ||
# | ||
# IM - Infrastructure Manager | ||
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import unittest | ||
import os | ||
import shutil | ||
|
||
from IM.auth import Authentication | ||
|
||
|
||
class TestAuth(unittest.TestCase): | ||
""" | ||
Class to test the Authentication class | ||
""" | ||
|
||
def test_auth_read(self): | ||
auth_lines = ["""id = 1; type = InfrastructureManager; username = someuser; password = somepass """, | ||
"""id = 2; type = VMRC; username = someuser; password = somepass; """, | ||
"""id = 3; type = OpenNebula; username = someuser; password = "some;'pass" """, | ||
"""id = 4; type = EC2; username = someuser; password = 'some;"pass' """] | ||
auth = Authentication.read_auth_data(auth_lines) | ||
self.assertEqual(auth, [{'id': '1', 'password': "somepass", | ||
'type': 'InfrastructureManager', 'username': 'someuser'}, | ||
{'id': '2', 'password': "somepass", | ||
'type': 'VMRC', 'username': 'someuser'}, | ||
{'id': '3', 'password': "some;'pass", | ||
'type': 'OpenNebula', 'username': 'someuser'}, | ||
{'id': '4', 'password': 'some;"pass', | ||
'type': 'EC2', 'username': 'someuser'}]) | ||
|
||
tests_path = os.path.dirname(os.path.abspath(__file__)) | ||
shutil.copyfile(os.path.join(tests_path, "../files/privatekey.pem"), "/tmp/privatekey.pem") | ||
auth = Authentication(Authentication.read_auth_data(os.path.join(tests_path, "../files/auth.dat"))) | ||
auth_data = auth.getAuthInfoByID("occi") | ||
self.assertEqual(auth_data[0]['proxy'][:37], "-----BEGIN RSA PRIVATE KEY-----\nMIIEo") | ||
os.unlink("/tmp/privatekey.pem") | ||
|
||
|
||
def test_get_auth(self): | ||
auth_lines = ["""id = 1; type = InfrastructureManager; username = someuser; password = somepass """, | ||
"""id = 2; type = VMRC; username = someuser; password = somepass; """] | ||
auth = Authentication(Authentication.read_auth_data(auth_lines)) | ||
auth_data = auth.getAuthInfoByID("1") | ||
self.assertEqual(auth_data, [{'id': '1', 'password': "somepass", | ||
'type': 'InfrastructureManager', 'username': 'someuser'}]) | ||
auth_data = auth.getAuthInfo("VMRC") | ||
self.assertEqual(auth_data, [{'id': '2', 'password': "somepass", | ||
'type': 'VMRC', 'username': 'someuser'}]) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |