def compile_file(self, filename, ns): if self.first_file: self.first_file = False self.rval = [] MOFCompiler.compile_file(self, filename, ns) return self.rval self.rval.append((ns, filename))
def setUp(self): """Create the MOF compiler.""" def moflog(msg): print(msg, file=self.logfile) moflog_file = os.path.join(SCRIPT_DIR, 'moflog.txt') self.logfile = open(moflog_file, 'w') self.mofcomp = MOFCompiler(MOFWBEMConnection(), search_paths=[SCHEMA_DIR], verbose=False, log_func=moflog)
def setup(self): """Create the MOF compiler.""" def moflog(msg): print >> self.logfile, msg self.logfile = open('moflog.txt', 'w') self.mofcomp = MOFCompiler(MOFWBEMConnection(), search_paths=['schema'], verbose=False, log_func=moflog) os.chdir(cwd)
def setUp(self): self.mofcomp = MOFCompiler(handle=None, log_func=_test_log) self.lexer = self.mofcomp.lexer self.last_error_t = None # saves 't' arg of t_error() def test_t_error(t): """Our replacement for t_error() when testing.""" self.last_error_t = t self.saved_t_error(t) self.saved_t_error = mof_compiler.t_error mof_compiler.t_error = test_t_error
def __init__(self): self.first_file = True self.handle = MOFWBEMConnection() self.handle = SimpleHandle() MOFCompiler.__init__(self, self.handle)
# if removing, we'll be verbose later when we actually remove stuff. # We don't want MOFCompiler to be verbose, as that would be confusing. verbose = options.verbose and not options.remove for peg in pegs: if options.remove: conn = pywbem.WBEMConnection(peg['url'], creds) conn = MOFWBEMConnection(conn=conn) else: conn = InstStoringConn(peg['url'], creds) #conn.debug = True conn.default_namespace = options.ns mofcomp = MOFCompiler(handle=conn, search_paths=search, verbose=verbose) try: process_pegasus(moffile, mofcomp, peg['init'], peg['exe'], remove=options.remove, provider_dir=peg['provider_dir'], env=peg['env']) except MOFParseError as pe: sys.exit(1) except pywbem.CIMError as ce: sys.exit(1)