Skip to content

Commit a6c2a56

Browse files
author
Ankit Bhagat
committed
added gitignore and new spl
1 parent 89bb6e2 commit a6c2a56

29 files changed

+326
-198
lines changed

.gitignore

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/

HadoopConnect.spl

768 KB
Binary file not shown.

HadoopConnect/appserver/controllers/exportjobs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def updateRED(self, action, id, **kwargs):
137137

138138
if len(update_props):
139139
exportJob.update(update_props)
140-
if exportJob.entity and exportJob.entity.owner:
141-
exportJob.entity.owner='nobody'
140+
if exportJob.entity and exportJob.entity.owner:
141+
exportJob.entity.owner='nobody'
142142
if not exportJob.passive_save():
143143
cherrypy.response.status = 500
144144
return self.render_json(dict(success = False, errors = [ str(e) for e in exportJob.errors ]))
@@ -179,7 +179,7 @@ def custom_action(self, action, id):
179179
exportJob = HDFSExport.get(id)
180180
done = getattr(exportJob, action)()
181181
#do we need generic exception here?
182-
except Exception, e:
182+
except Exception as e:
183183
logger.warn('Could not %s export job: %s, %s' % (action, id, str(e)))
184184
if done:
185185
return self.render_json(dict(success = True))

HadoopConnect/bin/HadoopConnect/models/cluster.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys,os
2+
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
13
from hdfs_base import HDFSAppObjModel
24
from splunk.models.field import Field, BoolField, IntField
35

HadoopConnect/bin/HadoopConnect/models/export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys,os
2+
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
13
from hdfs_base import HDFSAppObjModel
24
import time
35
import logging

HadoopConnect/bin/HadoopConnect/models/hdfs_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from splunk.models.base import SplunkAppObjModel
2+
import sys,os
3+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..",".."))
24
import errors
35

46
'''

HadoopConnect/bin/HadoopConnect/models/principal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys,os
2+
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
13
from hdfs_base import HDFSAppObjModel
24
from splunk.models.field import Field
35

HadoopConnect/bin/clusters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def getLocalHadoopVersion(self):
8080
try:
8181
process = self.openProcess(args, env)
8282
output = process.communicate()
83-
except Exception, e:
83+
except Exception as e:
8484
logger.exception('Failed to run process')
8585
raise HcException(HCERR0013, {'error':str(e)})
8686
if process.returncode != 0:
@@ -97,7 +97,7 @@ def save(self):
9797
if not os.path.isdir(dir):
9898
os.makedirs(dir)
9999
self.saveXml()
100-
except Exception, e:
100+
except Exception as e:
101101
logger.exception('Failed to create cluster xml configurations')
102102
raise HcException(HCERR1518, {'name':self.name, 'error':str(e)})
103103

@@ -107,7 +107,7 @@ def remove(self):
107107
if os.path.isdir(dir):
108108
import shutil
109109
shutil.rmtree(dir)
110-
except Exception, e:
110+
except Exception as e:
111111
raise HcException(HCERR1516, {'name':self.name, 'error':str(e)})
112112

113113
def getClusterDir(self):

HadoopConnect/bin/delegating_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def saveConf(self, confName, stanzaName, settingsDict):
7777
def simpleRequest(self, uri, method='GET', postargs=None, raiseAllErrors=True):
7878
try:
7979
response, content = rest.simpleRequest(uri, self.getSessionKey(), method=method, postargs=postargs, raiseAllErrors=raiseAllErrors)
80-
except Exception, e:
80+
except Exception as e:
8181
raise HcException(HCERR2006, {'uri':uri, 'status':'', 'reason':str(e), 'response':''})
8282

8383
if response.status not in [200, 201] and raiseAllErrors:

HadoopConnect/bin/errors.py

Lines changed: 43 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def __init__(self, message_format, options={}):
223223
if len(options) > 0:
224224
try:
225225
d = json.loads(message_format)
226-
for k,v in options.iteritems():
226+
for k,v in options.items():
227227
d[k] = v
228228
self.value = json.dumps(d)
229229
except:
@@ -256,25 +256,23 @@ def __str__(self):
256256
e = HcException(HCERR2002, {'entity_path':'', 'search':'', 'uri':uri, 'error':msg})
257257

258258
# case 0: fill up a int value and get it back later
259-
print 'case 0'
259+
print ('case 0')
260260
d = json.loads(HCERR1505)
261261
d['peer_count'] = 5
262262
s = json.dumps(d)
263263
d = json.loads(s)
264-
print 'peer_count: %d' % d['peer_count']
265-
print
264+
print ('peer_count: %d' % d['peer_count'])
266265

267266
# case 1, msg is a simple error message, manually construct a json error message, then convert to dict object, should pass test
268-
print 'case 1'
267+
print ('case 1')
269268
msg = "In handler \'savedsearch\': Unable to create a saved search with name \'ExportSearch:test-error-message\'. A saved search with that name already exists."
270269
json_str = HCERR1506 % ('test-error-message', msg)
271-
print json_str
272-
print json.loads(json_str)
273-
print
270+
print (json_str)
271+
print (json.loads(json_str))
274272

275273
# case 2: msg is very complex:
276274
# 1) manually build dict object 2) convert dict to json error message 3) convert json string back to dict. should pass test
277-
print 'case 2'
275+
print ('case 2')
278276
msg = "[HTTP 409] [{'text': \"In handler 'savedsearch': Unable to create saved search with name 'ExportSearch: test-error-message'. A saved search with that name already exists.\", 'code': None, 'type': 'ERROR'}]"
279277
# 1) manually build dict object
280278
d = {}
@@ -284,94 +282,88 @@ def __str__(self):
284282
d['error'] = msg
285283
# 2) convert dict to json error message
286284
json_str = json.dumps(d)
287-
print json_str
285+
print (json_str)
288286
# 3) convert json string back to dict
289287
d = json.loads(json_str)
290-
print d
291-
print d['id']
292-
print d['message']
293-
print d['export']
294-
print d['error']
295-
print
288+
print (d)
289+
print (d['id'])
290+
print (d['message'])
291+
print (d['export'])
292+
print (d['error'])
296293

297294
# case 3: msg is very complex, but HCERR1506 is a simple json string and is sure to be able to convert to dict.
298295
# 1) convert HCERR1506 to dict
299296
# 2) fill up the blank (export and error in this case)
300297
# 3) convert dict to json error message
301298
# 4) convert json string back to dict
302299
# should pass test.
303-
print 'case 3'
300+
print ('case 3')
304301
# 1) convert HCERR1506 to dict
305302
d = json.loads(HCERR1506)
306303
# 2) fill up the blank (export and error in this case)
307304
d['export'] = 'test-error-message'
308305
d['error'] = msg
309306
# 3) convert dict to json error message
310307
json_str = json.dumps(d)
311-
print json_str
308+
print (json_str)
312309
# 4) convert json string back to dict
313310
d = json.loads(json_str)
314-
print d
315-
print d['id']
316-
print d['message']
317-
print d['export']
318-
print d['error']
319-
print
311+
print (d)
312+
print (d['id'])
313+
print (d['message'])
314+
print (d['export'])
315+
print (d['error'])
320316

321317
# case 4: msg is very complex.
322318
# 1) create HcExeption with msg 2) get error dict from the exception
323319
# should pass test
324-
print 'case 4'
320+
print ('case 4')
325321
# 1) create HcExeption with msg
326322
e = HcException(HCERR1506, {'export':'test-error-message', 'error':msg})
327323
# 2) get error dict from the exception
328324
d = e.error
329-
print d
330-
print d['id']
331-
print d['message']
332-
print d['export']
333-
print d['error']
334-
print
325+
print (d)
326+
print (d['id'])
327+
print (d['message'])
328+
print (d['export'])
329+
print (d['error'])
335330

336331
# case 5: msg is very complex.
337332
# 1) create HcExeption with msg and more fields (foo) than it is needed 2) get error dict from the exception
338333
# should pass test
339-
print 'case 5'
334+
print ('case 5')
340335
# 1) create HcExeption with msg
341336
e = HcException(HCERR1506, {'export':'test-error-message', 'error':msg, 'foo':'bar'})
342337
# 2) get error dict from the exception
343338
d = e.error
344-
print d
345-
print d['id']
346-
print d['message']
347-
print d['export']
348-
print d['error']
349-
print d['foo']
350-
print
351-
339+
print (d)
340+
print (d['id'])
341+
print (d['message'])
342+
print (d['export'])
343+
print (d['error'])
344+
print (d['foo'])
345+
352346
# case 6: msg is very complex.
353347
# 1) create HcExeption with msg and less fields (export) than it is needed 2) get error dict from the exception
354348
# should pass test
355-
print 'case 6'
349+
print ('case 6')
356350
# 1) create HcExeption with msg
357351
e = HcException(HCERR1506, {'error':msg})
358352
# 2) get error dict from the exception
359353
d = e.error
360-
print d
361-
print d['id']
362-
print d['message']
363-
print d['export']
364-
print d['error']
365-
print
354+
print (d)
355+
print (d['id'])
356+
print (d['message'])
357+
print (d['export'])
358+
print (d['error'])
366359

367360
# case 7: msg is very complex
368361
# 1) manually construct a json error string
369362
# 2 ) convert it to dict object
370363
# should fail test
371-
print 'case 7'
364+
print ('case 7')
372365
# 1) manually construct a json error string
373366
json_str = HCERR1506 % ('test-error-message', msg)
374-
print json_str
367+
print (json_str)
375368
# 2 ) convert it to dict object
376-
print json.loads(json_str)
377-
369+
print (json.loads(json_str))

0 commit comments

Comments
 (0)