Commit 0a919d2f authored by Marco Mariani's avatar Marco Mariani

further import cleanup

parent 20e9ad51
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: set et sts=2:
############################################################################## ##############################################################################
# #
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. # Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
...@@ -27,17 +28,17 @@ ...@@ -27,17 +28,17 @@
# #
############################################################################## ##############################################################################
import logging import grp
import hashlib import hashlib
import logging
import os import os
import pkg_resources import pkg_resources
import pwd
import stat import stat
import subprocess import subprocess
import sys import sys
import pwd
import grp from slapos.grid.exception import BuildoutFailedError, WrongPermissionError
from exception import BuildoutFailedError, WrongPermissionError
from hashlib import md5
# Such umask by default will create paths with full permission # Such umask by default will create paths with full permission
# for user, non writable by group and not accessible by others # for user, non writable by group and not accessible by others
...@@ -116,7 +117,7 @@ class SlapPopen(subprocess.Popen): ...@@ -116,7 +117,7 @@ class SlapPopen(subprocess.Popen):
self.output = ''.join(output_lines) self.output = ''.join(output_lines)
def md5digest(url): def md5digest(url):
return md5(url).hexdigest() return hashlib.md5(url).hexdigest()
def getCleanEnvironment(home_path='/tmp'): def getCleanEnvironment(home_path='/tmp'):
......
...@@ -25,16 +25,12 @@ ...@@ -25,16 +25,12 @@
# #
############################################################################## ##############################################################################
from slapos.grid import slapgrid
import httplib import httplib
import logging import logging
import os import os
from random import random import random
import shutil import shutil
import signal import signal
import slapos.slap.slap
import slapos.grid.utils
from slapos.grid.watchdog import Watchdog, getWatchdogID
import socket import socket
import sys import sys
import tempfile import tempfile
...@@ -42,8 +38,15 @@ import textwrap ...@@ -42,8 +38,15 @@ import textwrap
import time import time
import unittest import unittest
import urlparse import urlparse
import xml_marshaller import xml_marshaller
import slapos.slap.slap
import slapos.grid.utils
from slapos.grid import slapgrid
from slapos.grid.utils import md5digest
from slapos.grid.watchdog import Watchdog, getWatchdogID
dummylogger = logging.getLogger() dummylogger = logging.getLogger()
...@@ -383,11 +386,11 @@ class InstanceForTest: ...@@ -383,11 +386,11 @@ class InstanceForTest:
os.mkdir(certificate_repository_path) os.mkdir(certificate_repository_path)
self.cert_file = os.path.join(certificate_repository_path, self.cert_file = os.path.join(certificate_repository_path,
"%s.crt" % self.name) "%s.crt" % self.name)
self.certificate = str(random()) self.certificate = str(random.random())
open(self.cert_file, 'w').write(self.certificate) open(self.cert_file, 'w').write(self.certificate)
self.key_file = os.path.join(certificate_repository_path, self.key_file = os.path.join(certificate_repository_path,
"%s.key" % self.name) "%s.key" % self.name)
self.key = str(random()) self.key = str(random.random())
open(self.key_file, 'w').write(self.key) open(self.key_file, 'w').write(self.key)
class SoftwareForTest: class SoftwareForTest:
...@@ -402,8 +405,7 @@ class SoftwareForTest: ...@@ -402,8 +405,7 @@ class SoftwareForTest:
self.software_root = software_root self.software_root = software_root
self.name = 'http://sr%s/' % name self.name = 'http://sr%s/' % name
self.sequence = [] self.sequence = []
self.software_hash = \ self.software_hash = md5digest(self.name)
slapos.grid.utils.md5digest(self.name)
self.srdir = os.path.join(self.software_root, self.software_hash) self.srdir = os.path.join(self.software_root, self.software_hash)
self.requested_state = 'available' self.requested_state = 'available'
os.mkdir(self.srdir) os.mkdir(self.srdir)
......
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