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

further import cleanup

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