diff options
author | Michal Minar <miminar@redhat.com> | 2013-02-26 14:41:18 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-02-26 14:41:18 +0100 |
commit | 282aa360c1ab3c58622d9e284bb0b3600e8997b4 (patch) | |
tree | dc1e102c42e06596b7f09433cbfec7c1261809e9 /src/software/openlmi/software/core/SoftwareIdentityResource.py | |
parent | 4214208d559ed88f3b29bc046d4679824bf5faa7 (diff) | |
download | openlmi-providers-282aa360c1ab3c58622d9e284bb0b3600e8997b4.tar.gz openlmi-providers-282aa360c1ab3c58622d9e284bb0b3600e8997b4.tar.xz openlmi-providers-282aa360c1ab3c58622d9e284bb0b3600e8997b4.zip |
lot of bugfixes in communication
communication:
* now the client can detect YumWorker's early termination and restart it
* session level is counted on client and server side
- this allows to restore session state, when process is restarted
* minimized session nesting on server to 1 at max
- thanks to counter on client side
- reduces communication traffic
* improved logging
api changes:
* PackageInfo's pkgid renamed to objid
* Repository's name renamed to repoid
caption renamed to name
* added include_repos and exclude_repos to YumDB methods, where
it makes sense
other bugfixes:
* fixed issues with repo enable
* assigning None to Instance properties with CIMProperty values
instead of skipping the value assignment to prevent using
old reference to value
allowed for repository management
- enable/disable
allowed to list/filter packages of particular repositories
added filter for packages to match those belonging to repository
testing:
* improved testing speed using run.py script
* removed unfinishable tests
Diffstat (limited to 'src/software/openlmi/software/core/SoftwareIdentityResource.py')
-rw-r--r-- | src/software/openlmi/software/core/SoftwareIdentityResource.py | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/software/openlmi/software/core/SoftwareIdentityResource.py b/src/software/openlmi/software/core/SoftwareIdentityResource.py index d8e6877..722c29b 100644 --- a/src/software/openlmi/software/core/SoftwareIdentityResource.py +++ b/src/software/openlmi/software/core/SoftwareIdentityResource.py @@ -535,7 +535,7 @@ def object_path2repo(env, op, kind='enabled'): raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, 'SystemCreationClassName of \"%s\" must be a subclass of "%s".' % (op["CreationClassName"], "CIM_SoftwareIdentityResource")) - repos = YumDB.get_instance().filter_repositories(kind, name=op["Name"]) + repos = YumDB.get_instance().filter_repositories(kind, repoid=op["Name"]) if len(repos) < 1: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, 'No matching repository found for Name=\"%s\".' % op["Name"]) @@ -546,30 +546,30 @@ def _fill_non_keys(repo, model): """ Fills into the model of instance all non-key properties. """ - for slot in repo.__slots__: - cmpi_logging.logger.info("repo[name=%s].%s=%s", - repo.name, slot, str(getattr(repo, slot))) model['AccessContext'] = Values.AccessContext.Other if repo.mirror_list: - model['AccessInfo'] = repo.mirror_list + access_info = repo.mirror_list elif repo.base_urls: if len(repo.base_urls) > 0: if len(repo.base_urls) > 1: cmpi_logging.logger.warn( 'multiple base urls found for repository "%s", selecting' ' the last one', repo) - model['AccessInfo'] = repo.base_urls[-1] + access_info = repo.base_urls[-1] else: cmpi_logging.logger.error( 'no base url found for repository "%s"' % repo) + access_info = pywbem.CIMProperty('AccessInfo', + None, type='string') + model["AccessInfo"] = access_info model['AvailableRequestedStates'] = [ Values.AvailableRequestedStates.Enabled, Values.AvailableRequestedStates.Disabled] - model['Caption'] = repo.caption + model['Caption'] = repo.name model['Cost'] = pywbem.Sint32(repo.cost) model['Description'] = "[%s] - %s for %s architecture with cost %d" % ( - repo.name, repo.caption, repo.basearch, repo.cost) - model['ElementName'] = repo.name + repo.repoid, repo.name, repo.basearch, repo.cost) + model['ElementName'] = repo.repoid model['EnabledDefault'] = Values.EnabledDefault.Not_Applicable if repo.enabled: model['EnabledState'] = Values.EnabledState.Enabled @@ -583,10 +583,16 @@ def _fill_non_keys(repo, model): model['HealthState'] = Values.HealthState.Major_failure if repo.revision is not None: model["Generation"] = pywbem.Uint64(repo.revision) + else: + model['Generation'] = pywbem.CIMProperty('Generation', + None, type='uint64') model['InfoFormat'] = Values.InfoFormat.URL - model['InstanceID'] = 'LMI:REPO:' + repo.name + model['InstanceID'] = 'LMI:REPO:' + repo.repoid if repo.mirror_list: model["MirrorList"] = repo.mirror_list + else: + model['MirrorList'] = pywbem.CIMProperty('MirrorList', + None, type='string') model['OperationalStatus'] = [ Values.OperationalStatus.OK if repo.ready else Values.OperationalStatus.Error] model['OtherAccessContext'] = "YUM package repository" @@ -607,6 +613,9 @@ def _fill_non_keys(repo, model): model['TimeOfLastStateChange'] = pywbem.CIMDateTime(repo.last_edit) if repo.last_update is not None: model['TimeOfLastUpdate'] = pywbem.CIMDateTime(repo.last_update) + else: + model['TimeOfLastUpdate'] = pywbem.CIMProperty('TimeOfLastUpdate', + None, type='datetime') model['TransitioningToState'] = Values.TransitioningToState.Not_Applicable @cmpi_logging.trace_function @@ -631,7 +640,7 @@ def repo2model(repo, keys_only=True, model=None): else: _set_key = model.__setitem__ _set_key('CreationClassName', "LMI_SoftwareIdentityResource") - _set_key("Name", repo.name) + _set_key("Name", repo.repoid) _set_key("SystemCreationClassName", "Linux_ComputerSystem") _set_key("SystemName", ComputerSystem.get_path()["Name"]) if not keys_only: |