Further shuffling to get this to fit the standard code layout
* Move tests and code into elastic_recheck * Get 'tox -epy27' working * Tweak setup.cfg for elastic_recheck The goal here is: pip install elastic-recheck, import elastic_recheck Change-Id: Iab9fdf49dc51127a826f0908da3c238c49cbe434
This commit is contained in:
parent
adb6ac6164
commit
20a2caf85e
@ -28,6 +28,16 @@ import time
|
|||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
|
|
||||||
|
REQUIRED_FILES = [
|
||||||
|
'console.html',
|
||||||
|
'logs/screen-key.txt',
|
||||||
|
'logs/screen-n-api.txt',
|
||||||
|
'logs/screen-n-cpu.txt',
|
||||||
|
'logs/screen-n-sch.txt',
|
||||||
|
'logs/screen-c-api.txt',
|
||||||
|
'logs/screen-c-vol.txt'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Stream(object):
|
class Stream(object):
|
||||||
"""Gerrit Stream.
|
"""Gerrit Stream.
|
||||||
@ -205,16 +215,7 @@ class Classifier():
|
|||||||
results = self.es.search(query, size='80')
|
results = self.es.search(query, size='80')
|
||||||
files = results['facets']['tag']['terms']
|
files = results['facets']['tag']['terms']
|
||||||
files = [x['term'] for x in files]
|
files = [x['term'] for x in files]
|
||||||
required_files = [
|
missing_files = [x for x in REQUIRED_FILES if x not in files]
|
||||||
'console.html',
|
|
||||||
'logs/screen-key.txt',
|
|
||||||
'logs/screen-n-api.txt',
|
|
||||||
'logs/screen-n-cpu.txt',
|
|
||||||
'logs/screen-n-sch.txt',
|
|
||||||
'logs/screen-c-api.txt',
|
|
||||||
'logs/screen-c-vol.txt'
|
|
||||||
]
|
|
||||||
missing_files = [x for x in required_files if x not in files]
|
|
||||||
if len(missing_files) is 0:
|
if len(missing_files) is 0:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -233,16 +234,6 @@ class Classifier():
|
|||||||
|
|
||||||
class RequiredFiles(object):
|
class RequiredFiles(object):
|
||||||
|
|
||||||
required_files = [
|
|
||||||
'console.html',
|
|
||||||
'logs/screen-key.txt',
|
|
||||||
'logs/screen-n-api.txt',
|
|
||||||
'logs/screen-n-cpu.txt',
|
|
||||||
'logs/screen-n-sch.txt',
|
|
||||||
'logs/screen-c-api.txt',
|
|
||||||
'logs/screen-c-vol.txt'
|
|
||||||
]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prep_url(url):
|
def prep_url(url):
|
||||||
if isinstance(url, list):
|
if isinstance(url, list):
|
||||||
@ -254,12 +245,16 @@ class RequiredFiles(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def files_at_url(url):
|
def files_at_url(url):
|
||||||
for f in RequiredFiles.required_files:
|
for f in REQUIRED_FILES:
|
||||||
try:
|
try:
|
||||||
urllib2.urlopen(url + '/' + f).code
|
urllib2.urlopen(url + '/' + f).code
|
||||||
except urllib2.HTTPError:
|
except urllib2.HTTPError:
|
||||||
# File does not exist at URL
|
try:
|
||||||
return False
|
urllib2.urlopen(url + '/' + f + '.gz').code
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
# File does not exist at URL
|
||||||
|
print f
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
0
elastic_recheck/tests/__init__.py
Normal file
0
elastic_recheck/tests/__init__.py
Normal file
@ -26,8 +26,9 @@ class TestGerritComment(testtools.TestCase):
|
|||||||
config = ConfigParser.ConfigParser({'server_password': None})
|
config = ConfigParser.ConfigParser({'server_password': None})
|
||||||
config.read('elasticRecheck.conf')
|
config.read('elasticRecheck.conf')
|
||||||
self.user = config.get('gerrit', 'user')
|
self.user = config.get('gerrit', 'user')
|
||||||
|
key = config.get('gerrit', 'key')
|
||||||
host = 'review-dev.openstack.org'
|
host = 'review-dev.openstack.org'
|
||||||
self.stream = elasticRecheck.Stream(self.user, host, thread=False)
|
self.stream = elasticRecheck.Stream(self.user, host, key, thread=False)
|
||||||
port = 29418
|
port = 29418
|
||||||
self.gerrit = gerritlib.gerrit.Gerrit(host, self.user, port)
|
self.gerrit = gerritlib.gerrit.Gerrit(host, self.user, port)
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import elasticRecheck
|
from elastic_recheck import elasticRecheck
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
|
12
setup.cfg
12
setup.cfg
@ -21,7 +21,7 @@ classifier =
|
|||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
elastic-recheck
|
elastic_recheck
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
source-dir = doc/source
|
source-dir = doc/source
|
||||||
@ -32,15 +32,15 @@ all_files = 1
|
|||||||
upload-dir = doc/build/html
|
upload-dir = doc/build/html
|
||||||
|
|
||||||
[compile_catalog]
|
[compile_catalog]
|
||||||
directory = elastic-recheck/locale
|
directory = elastic_recheck/locale
|
||||||
domain = elastic-recheck
|
domain = elastic_recheck
|
||||||
|
|
||||||
[update_catalog]
|
[update_catalog]
|
||||||
domain = elastic-recheck
|
domain = elastic-recheck
|
||||||
output_dir = elastic-recheck/locale
|
output_dir = elastic_recheck/locale
|
||||||
input_file = elastic-recheck/locale/elastic-recheck.pot
|
input_file = elastic_recheck/locale/elastic-recheck.pot
|
||||||
|
|
||||||
[extract_messages]
|
[extract_messages]
|
||||||
keywords = _ gettext ngettext l_ lazy_gettext
|
keywords = _ gettext ngettext l_ lazy_gettext
|
||||||
mapping_file = babel.cfg
|
mapping_file = babel.cfg
|
||||||
output_file = elastic-recheck/locale/elastic-recheck.pot
|
output_file = elastic_recheck/locale/elastic-recheck.pot
|
||||||
|
Loading…
Reference in New Issue
Block a user