コード例 #1
0
ファイル: cibobjects.py プロジェクト: aomoriringo/crmsh
 def __init__(self):
     Expr.__init__(self)
     self.id = None
     self.uname = None
     self.type = None
     self.attributes = odict()
     self.utilization = odict()
コード例 #2
0
 def __init__(self):
     Expr.__init__(self)
     self.id = None
     self.uname = None
     self.type = None
     self.attributes = odict()
     self.utilization = odict()
コード例 #3
0
ファイル: cibobjects.py プロジェクト: aomoriringo/crmsh
 def __init__(self):
     Expr.__init__(self)
     self.id = None
     self.template = None
     self.params = odict()
     self.meta = odict()
     self.operations = []
     self.ra_class = None
     self.ra_provider = None
     self.ra_type = None
     self.utilization = odict()
     self.children = []
コード例 #4
0
 def __init__(self):
     Expr.__init__(self)
     self.id = None
     self.template = None
     self.params = odict()
     self.meta = odict()
     self.operations = []
     self.ra_class = None
     self.ra_provider = None
     self.ra_type = None
     self.utilization = odict()
     self.children = []
コード例 #5
0
ファイル: crm_gv.py プロジェクト: lge/crmsh
 def __init__(self, id=None):
     if id:
         self.id = self.gv_id(id)
     else:
         self.id = ""
     self.nodes = {}
     self.edges = []
     self.subgraphs = []
     self.node_attrs = odict()
     self.attrs = odict()
     self.graph_attrs = odict()
     self.edge_attrs = []
     self.top_nodes = []
     self.norank_nodes = []
コード例 #6
0
ファイル: crm_gv.py プロジェクト: HideoYamauchi/crmsh
 def __init__(self, id=None):
     if id:
         self.id = self.gv_id(id)
     else:
         self.id = ""
     self.nodes = {}
     self.edges = []
     self.subgraphs = []
     self.node_attrs = odict()
     self.attrs = odict()
     self.graph_attrs = odict()
     self.edge_attrs = []
     self.top_nodes = []
     self.norank_nodes = []
コード例 #7
0
ファイル: crm_gv.py プロジェクト: lge/crmsh
 def new_edge(self, e):
     ne = self.my_edge(e)
     for i, node in enumerate(ne):
         if i == 0:
             continue
         if node in self.top_nodes:
             continue
         self.nodes[node] = i
     self.edges.append(ne)
     self.edge_attrs.append(odict())
     return len(self.edges)-1
コード例 #8
0
ファイル: crm_gv.py プロジェクト: HideoYamauchi/crmsh
 def new_edge(self, e):
     ne = self.my_edge(e)
     for i, node in enumerate(ne):
         if i == 0:
             continue
         if node in self.top_nodes:
             continue
         self.nodes[node] = i
     self.edges.append(ne)
     self.edge_attrs.append(odict())
     return len(self.edges) - 1
コード例 #9
0
ファイル: container.py プロジェクト: RBINS/mars
    def importCatsFromText(self, text, filename='', catseparator=' / '):
        if '---' not in text:
            if filename is not '':
                print 'Could not import:' + \
                      'no root category defined in %s.' % filename
            else:
                print 'Problem while importing: no root category defined.'
            return
        text.replace('\r\n', '\n')
        lines = text.split('\n')
        lines = [ l.split('#')[0] for l in lines ]
        lines = [ l.strip() for l in lines if l and not l.isspace() ]
        rootname = None
        rootcontainer = None

        catsdict = odict()
        for line in lines:
            if not line.startswith('---'):
                if not catseparator in line \
                and not lines.index(line) == len(lines)-1 \
                and lines[lines.index(line)+1].startswith('---'):
                    rootname = line.strip()
                    catsdict[rootname] = odict()
                else:
                    cats = [ m[2] or twoquotes.sub('"', m[1]) for m in catspat.findall(line) ]
                    if rootname and rootname != cats[0]:
                        cats.insert(0, rootname)
                    parent = catsdict
                    for cat in [ c.strip() for c in cats if c not in ('-',) ]:
                        if cat == '':
                            cat = '(Unnamed category)'
                        if cat not in parent.keys():
                            parent[cat] = dict()
                        parent = parent[cat]
        catalog = getToolByName(self, 'portal_catalog')
        _categscache.clear()
        createCatsFromDict(catalog, 
                           '/'.join(self.getPhysicalPath()), 
                           catsdict)
        log.info('Creation done.')
コード例 #10
0
 def process(entry):
     'writes the entry into topics/levels/commands'
     short_help = entry['short']
     long_help = entry['long']
     if long_help.startswith('=='):
         long_help = long_help.split('\n', 1)[1]
     helpobj = HelpEntry(short_help, long_help.rstrip())
     name = entry['name']
     if entry['type'] == 'topic':
         _TOPICS[name] = helpobj
     elif entry['type'] == 'level':
         _LEVELS[name] = helpobj
     elif entry['type'] == 'command':
         lvl = entry['level']
         if lvl not in _COMMANDS:
             _COMMANDS[lvl] = odict()
         _COMMANDS[lvl][name] = helpobj
コード例 #11
0
ファイル: help.py プロジェクト: aomoriringo/crmsh
 def process(entry):
     'writes the entry into topics/levels/commands'
     short_help = entry['short']
     long_help = entry['long']
     if long_help.startswith('=='):
         long_help = long_help.split('\n', 1)[1]
     helpobj = HelpEntry(short_help, long_help.rstrip())
     name = entry['name']
     if entry['type'] == 'topic':
         _TOPICS[name] = helpobj
     elif entry['type'] == 'level':
         _LEVELS[name] = helpobj
     elif entry['type'] == 'command':
         lvl = entry['level']
         if lvl not in _COMMANDS:
             _COMMANDS[lvl] = odict()
         _COMMANDS[lvl][name] = helpobj
コード例 #12
0
ファイル: help.py プロジェクト: aomoriringo/crmsh
def add_help(entry, topic=None, level=None, command=None):
    '''
    Takes a help entry as argument and inserts it into the
    help system.

    Used to define some help texts statically, for example
    for 'up' and 'help' itself.
    '''
    if topic:
        if topic not in _TOPICS or _TOPICS[topic] is _DEFAULT:
            _TOPICS[topic] = entry
    elif level and command:
        if level not in _LEVELS:
            _LEVELS[level] = HelpEntry("No description available", generated=True)
        if level not in _COMMANDS:
            _COMMANDS[level] = odict()
        lvl = _COMMANDS[level]
        if command not in lvl or lvl[command] is _DEFAULT:
            lvl[command] = entry
    elif level:
        if level not in _LEVELS or _LEVELS[level] is _DEFAULT:
            _LEVELS[level] = entry
コード例 #13
0
def add_help(entry, topic=None, level=None, command=None):
    '''
    Takes a help entry as argument and inserts it into the
    help system.

    Used to define some help texts statically, for example
    for 'up' and 'help' itself.
    '''
    if topic:
        if topic not in _TOPICS or _TOPICS[topic] is _DEFAULT:
            _TOPICS[topic] = entry
    elif level and command:
        if level not in _LEVELS:
            _LEVELS[level] = HelpEntry("No description available", generated=True)
        if level not in _COMMANDS:
            _COMMANDS[level] = odict()
        lvl = _COMMANDS[level]
        if command not in lvl or lvl[command] is _DEFAULT:
            lvl[command] = entry
    elif level:
        if level not in _LEVELS or _LEVELS[level] is _DEFAULT:
            _LEVELS[level] = entry
コード例 #14
0
ファイル: constants.py プロジェクト: unixbhaskar/crmsh
    "meta_attributes": "meta_attributes",
    "utilization": "utilization",
    "operations": "ops",
    "rule": "rule",
    "expression": "expression",
    "date_expression": "expression",
    "duration": "duration",
    "date_spec": "date_spec",
    "read": "read",
    "write": "write",
    "deny": "deny",
}
acl_rule_names = ("read", "write", "deny")
acl_spec_map = odict({
    "xpath": "xpath",
    "ref": "ref",
    "tag": "tag",
    "attribute": "attribute",
})
# ACLs were rewritten in pacemaker 1.1.12
# this is the new acl syntax
acl_spec_map_2 = odict({
    "xpath": "xpath",
    "ref": "reference",
    "reference": "reference",
    "tag": "object-type",
    "type": "object-type",
    "attr": "attribute",
    "attribute": "attribute"
})

acl_spec_map_2_rev = (('xpath', 'xpath'),
コード例 #15
0
ファイル: crm_gv.py プロジェクト: HideoYamauchi/crmsh
 def new_attr(self, n, attr_n, attr_v):
     id = self.gv_id(n)
     if id not in self.attrs:
         self.attrs[id] = odict()
     self.attrs[id][attr_n] = attr_v
コード例 #16
0
ファイル: help.py プロジェクト: aomoriringo/crmsh
        return self.short

    def __repr__(self):
        return str(self)


HELP_FILE = os.path.join(config.path.sharedir, 'crm.8.txt')

_DEFAULT = HelpEntry('No help available', long_help='', alias_for=None, generated=True)
_REFERENCE_RE = re.compile(r'<<[^,]+,(.+)>>')

# loaded on demand
# _LOADED is set to True when an attempt
# has been made (so it won't be tried again)
_LOADED = False
_TOPICS = odict()
_LEVELS = odict()
_COMMANDS = odict()

_TOPICS["Overview"] = HelpEntry("Available help topics and commands", generated=True)
_TOPICS["Topics"] = HelpEntry("Available help topics", generated=True)


def _titleline(title, desc, suffix=''):
    return '%-16s %s\n' % (('`%s`' % (title)) + suffix, desc)


def help_overview():
    '''
    Returns an overview of all available
    topics and commands.
コード例 #17
0
ファイル: template.py プロジェクト: bluemellophone/wrapper
	constructor_parameters = [
		(parameter type, parameter name, parameter default value),	
	]

	IMPORTANT: 
	The order of this list must match the C++ constructor parameter order
'''
constructor_parameters = [	
	(CINT,  	'param_int',	1),   
	(CFLOAT, 	'param_float'	1.0)
	(CBOOL, 	'param_bool',	True),   
	(CCHAR, 	'param_char',	'1'),
]

# Do not touch
PARAM_ODICT = odict([(key, val) for (_type, key, val) in constructor_parameters])
PARAM_TYPES = [_type for (_type, key, val) in constructor_parameters]

#============================
# Python Interface
#============================

def _build_shared_c_library(rebuild=False):
	os.system("cd __DIRECTORY__")
	if rebuild:
		os.system("rm -rf build")

	retVal = os.system("./build_template_unix.sh")

	if retVal != 0:
		print("*" * 45)
コード例 #18
0
ファイル: crm_gv.py プロジェクト: lge/crmsh
 def new_attr(self, n, attr_n, attr_v):
     id = self.gv_id(n)
     if id not in self.attrs:
         self.attrs[id] = odict()
     self.attrs[id][attr_n] = attr_v
コード例 #19
0
        return str(self)


HELP_FILE = os.path.join(config.path.sharedir, 'crm.8.txt')

_DEFAULT = HelpEntry('No help available',
                     long_help='',
                     alias_for=None,
                     generated=True)
_REFERENCE_RE = re.compile(r'<<[^,]+,(.+)>>')

# loaded on demand
# _LOADED is set to True when an attempt
# has been made (so it won't be tried again)
_LOADED = False
_TOPICS = odict()
_LEVELS = odict()
_COMMANDS = odict()

_TOPICS["Overview"] = HelpEntry("Available help topics and commands",
                                generated=True)
_TOPICS["Topics"] = HelpEntry("Available help topics", generated=True)


def _titleline(title, desc, suffix=''):
    return '%-16s %s\n' % (('`%s`' % (title)) + suffix, desc)


def help_overview():
    '''
    Returns an overview of all available
コード例 #20
0
ファイル: constants.py プロジェクト: HideoYamauchi/crmsh
    "meta_attributes": "meta_attributes",
    "utilization": "utilization",
    "operations": "ops",
    "rule": "rule",
    "expression": "expression",
    "date_expression": "expression",
    "duration": "duration",
    "date_spec": "date_spec",
    "read": "read",
    "write": "write",
    "deny": "deny",
}
acl_rule_names = ("read", "write", "deny")
acl_spec_map = odict({
    "xpath": "xpath",
    "ref": "ref",
    "tag": "tag",
    "attribute": "attribute",
})
# ACLs were rewritten in pacemaker 1.1.12
# this is the new acl syntax
acl_spec_map_2 = odict({
    "xpath": "xpath",
    "ref": "reference",
    "reference": "reference",
    "tag": "object-type",
    "type": "object-type",
    "attr": "attribute",
    "attribute": "attribute"
})

acl_spec_map_2_rev = (('xpath', 'xpath'), ('reference', 'ref'),