Commit graph

223 commits

Author SHA1 Message Date
d20fb74324 use os.path.realpath instead, because it eliminates any symbolic links encountered in the path 2020-10-17 23:16:42 +03:00
174aa77280 __file__ already is absolute 2020-10-16 14:11:00 +03:00
fd04c03613 add parent dir to module search path only when importing fails 2020-10-16 13:42:16 +03:00
fdc1ab93e9 move scripts/* to bin/ 2020-10-14 02:20:58 +03:00
8ecae42199 remove bin/cdist script 2020-10-14 02:18:25 +03:00
Nico Schottelius
5fb66cd314 move build-helper into bin/
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-06-20 09:22:17 +02:00
Nico Schottelius
0cf0cdd0c3 keep version generating in build-helper, so people cloning from git don't need make
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-06-07 21:14:51 +02:00
Nico Schottelius
6e107fa92c Export PYTHONPATH so it's available for the emulator
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-11-02 16:27:28 +01:00
Nico Schottelius
10b6c31ac8 Rename cdist.py to scripts/cdist to avoid self import
naming cdist cdist.py and running import cdist, imports itself and thus raises an interesting error:

(virtualenv)[7:47] brief:virtualenv% cdist.py
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 230, in <module>
    commandline()
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 27, in commandline
    import cdist.banner
ImportError: No module named 'cdist.banner'; cdist is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 235, in <module>
    except cdist.Error as e:
AttributeError: 'module' object has no attribute 'Error'

Also described on

    http://www.velocityreviews.com/forums/t953596-error-executing-import-html-parser-from-a-script.html

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-10-30 11:47:16 +01:00
Nico Schottelius
3cf59fdf9a always use dynamic version - on shipping included generated version
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-10-25 23:45:56 +02:00
Nico Schottelius
91c1374657 begin restructering for python package
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-10-25 23:37:15 +02:00
Nico Schottelius
7833d4d64c Merge branch 'remote_prefix' 2012-05-29 15:41:48 +02:00
Steven Armstrong
4b33177d54 remove install command for now
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2012-05-25 17:07:59 +02:00
Steven Armstrong
f795b83c8e prevent a hen/egg problem when handling unsupported python versions
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2012-05-24 15:15:38 +02:00
Nico Schottelius
108283bbeb add default values in argparse
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-05-22 13:01:31 +02:00
Nico Schottelius
c7fbdc8195 add --remote-exec and --remote-copy to command line args
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-05-22 12:40:38 +02:00
Nico Schottelius
dc355e7aa2 be consistent - log parsing is easy
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-10 00:25:13 +01:00
Nico Schottelius
eef408c1b3 record failing host and continue
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-07 14:26:28 +01:00
Nico Schottelius
5001e9cbe7 prevent tracebacks in tempfile code/initial manifest from stdin
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-07 13:01:11 +01:00
Nico Schottelius
58a88ca5bd remove useless try: block that was needed to find out how multiprocess /sigint behaviour works
NOT needed: KeyBoardInterrupet (aka SIGINT) is forwarded to processes spawned by multiprocess!

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-07 11:50:16 +01:00
Nico Schottelius
531ad2966f in fork() do sys.exit() so parent knows about failures
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-07 11:48:41 +01:00
Nico Schottelius
d3b9aa6769 begin support for sensible exit codes of cdist
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-03-07 11:19:26 +01:00
Nico Schottelius
5e20ba5a13 ++logs, +import sys at top level
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-02-17 13:59:16 +01:00
Nico Schottelius
aa81486fe9 sys.exit() in try
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-02-17 13:47:00 +01:00
Nico Schottelius
81660b5d64 explicitly require python 3.2 on source host
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-01-06 13:17:35 +01:00
Steven Armstrong
b38262f858 implement reading initial manifest from stdin
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2011-10-31 16:07:33 +01:00
Nico Schottelius
0e7c532870 add new state code, begin to detect circular dependencies
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-19 15:32:06 +02:00
Nico Schottelius
ba6371c584 fix import error... stupid one
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-19 15:20:53 +02:00
Nico Schottelius
b7fdfb12e6 cleanups
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-18 22:40:29 +02:00
Nico Schottelius
8b9e6780b8 no need for a constant that's used two lines below
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-18 20:42:09 +02:00
Nico Schottelius
0344796d31 restructure imports
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-18 20:36:35 +02:00
Nico Schottelius
e3f3c48b22 wrap the whole program in the try...except KeyboardInterrupt block
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2011-10-18 20:34:35 +02:00
Nico Schottelius
dbdf036787 do not need to use terminate()/SIGTERM
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 12:04:04 +02:00
Nico Schottelius
1d1bff88b7 just as a marker: return false, so in theory even multiprocess noticed that we did something stuped
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 01:06:33 +02:00
Nico Schottelius
a587975a99 catch keyboardirq in parallel mode, so it's not raised into multiprocess
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 01:05:47 +02:00
Nico Schottelius
7b770b7b35 correctly report pid when killing subprocess
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 00:49:04 +02:00
Nico Schottelius
84e102eb29 also report failed hosts in sequential mode, terminate processes on interrupt, continue deploy even if one or more hosts failed
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 00:45:37 +02:00
Nico Schottelius
e8a81551f8 implement error reporting for failed hosts at the end
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 00:31:52 +02:00
Nico Schottelius
15ae422cb2 catch cdist errors in emulator or config install, not in main, because catching there does not work in multiprocess env
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 00:15:41 +02:00
Nico Schottelius
72687b5aeb create new method to encapsulate configinstall run of one host
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-16 00:12:51 +02:00
Nico Schottelius
92de3d2f10 need cdist module for various constens
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-15 23:23:30 +02:00
Nico Schottelius
e002710c4c rewrite emulator to class based approach for better logging
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-15 02:31:40 +02:00
Steven Armstrong
e2e2ddb33b add missing import
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2011-10-13 17:05:53 +02:00
Steven Armstrong
f1ff8d2f61 -todo
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2011-10-13 16:28:36 +02:00
Nico Schottelius
94a5558f3f ++todo in bin/cdist
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-13 12:20:51 +02:00
Nico Schottelius
2ec3753d94 cleanup context in main
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-11 16:45:18 +02:00
Nico Schottelius
29bb5f383c use context in cdist/bin
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-11 16:39:18 +02:00
Nico Schottelius
4c29d9839b configure logger based on hostname
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-11 16:19:27 +02:00
Nico Schottelius
d2b042ab7f remove parallel arg, always change logoutput
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-10 15:14:48 +02:00
Nico Schottelius
48a9309522 indent/+FIXME
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
2011-10-09 12:50:47 +02:00