diff options
author | Jan Safranek <jsafrane@redhat.com> | 2013-05-14 10:59:57 +0200 |
---|---|---|
committer | Jan Safranek <jsafrane@redhat.com> | 2013-05-14 11:00:51 +0200 |
commit | dabd7bea4dc803544a7e8af51b02eda0827a116a (patch) | |
tree | 94eb0c9a23d30b9ce66fa4a8eab1d25e28fe7268 /openlmi-register-pegasus | |
parent | 9d7da405dd0435ff220e594fc1017a1d5e74cc60 (diff) | |
download | openlmi-providers-dabd7bea4dc803544a7e8af51b02eda0827a116a.tar.gz openlmi-providers-dabd7bea4dc803544a7e8af51b02eda0827a116a.tar.xz openlmi-providers-dabd7bea4dc803544a7e8af51b02eda0827a116a.zip |
Updated register-pegasus script to generate better ProviderModuleName.
The PG_ProviderModule.ProviderModuleName is now taken from 'group:' field from
sfcbd .reg file. This makes sure that various Python providers, which use the
same libpyCmpiProvider.so, have different PG_ProviderModule.
Diffstat (limited to 'openlmi-register-pegasus')
-rwxr-xr-x | openlmi-register-pegasus | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/openlmi-register-pegasus b/openlmi-register-pegasus index 1830ec3..d314d27 100755 --- a/openlmi-register-pegasus +++ b/openlmi-register-pegasus @@ -26,7 +26,8 @@ reg_parse = re.compile(r"\[([^\]]+)\]\s+" "provider: ([^\s]+)\s+" "location: (\w+)\s+" "type: ([^\n]+)\s+" -"namespace: ([^\n]+)") +"namespace: ([^\n]+)\s+" +"(group: ([^\n]+)|)") # the group is optional Types = { 'instance': '2', @@ -37,18 +38,18 @@ Types = { 'instanceQuery': '7' } -def define_module(location): +def define_module(location, group): return """instance of PG_ProviderModule { - Name = "%(location)s"; + Name = "%(group)s"; Location = "%(location)s"; Vendor = "OpenLMI"; Version = "0.0.1"; InterfaceType = "CMPI"; InterfaceVersion = "2.0.0"; - ModuleGroupName = "%(location)s"; + ModuleGroupName = "%(group)s"; }; -""" % { 'location': location } +""" % { 'location': location, 'group': group } def getTypes(types): l = [] @@ -57,16 +58,16 @@ def getTypes(types): l.append(value) return ",".join(l) -def define_capability(location, provider, cls, types): +def define_capability(location, provider, cls, types, group): return """instance of PG_Provider { Name = "%(provider)s"; - ProviderModuleName = "%(location)s"; + ProviderModuleName = "%(group)s"; }; instance of PG_ProviderCapabilities { - ProviderModuleName = "%(location)s"; + ProviderModuleName = "%(group)s"; ProviderName = "%(provider)s"; CapabilityID = "%(class)s"; ClassName = "%(class)s"; @@ -75,14 +76,17 @@ instance of PG_ProviderCapabilities SupportedProperties = NULL; SupportedMethods = NULL; }; -""" % { 'location': location, 'provider': provider, 'class': cls, 'types': getTypes(types) } +""" % { 'location': location, 'provider': provider, 'class': cls, 'types': getTypes(types), 'group': group } modules_defined = {} for record in reg_parse.findall(sys.stdin.read()): - cls, provider, location, types, namespace = record + cls, provider, location, types, namespace, _unused, group = record - if location not in modules_defined: - print define_module(location) - modules_defined[location] = True + if not group: + group = location - print define_capability(location, provider, cls, types) + if group not in modules_defined: + print define_module(location, group) + modules_defined[group] = True + + print define_capability(location, provider, cls, types, group) |