commit d65c38256795098ba6c1f351b58d0e9da54db6da
Author: Michael Calmer
Date: Fri Jan 23 17:22:24 2009 +0100
make sure that our associations to CIM_System get the correct object
---
src/SUSE_Common.cc | 1 +
src/SUSE_HostedCollectionProvider.cc | 16 +++-
src/SUSE_InstalledSoftwareIdentityProvider.cc | 97 ++++++++-----------------
3 files changed, 43 insertions(+), 71 deletions(-)
diff --git a/src/SUSE_Common.cc b/src/SUSE_Common.cc
index a308a08..ff24827 100644
--- a/src/SUSE_Common.cc
+++ b/src/SUSE_Common.cc
@@ -395,6 +395,7 @@ namespace cmpizypp
return false;
}
+ // FIXME: currently not used. Perhaps we can remove it
bool _assoc_create_inst_1toN( CmpiBroker & broker,
const CmpiContext & ctx,
CmpiResult & rslt,
diff --git a/src/SUSE_HostedCollectionProvider.cc b/src/SUSE_HostedCollectionProvider.cc
index b4a1ad6..9a65c7f 100644
--- a/src/SUSE_HostedCollectionProvider.cc
+++ b/src/SUSE_HostedCollectionProvider.cc
@@ -41,12 +41,16 @@ namespace cmpizypp
{
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() called",_ClassName));
- if(!assoc_create_inst_1toN( *broker, ctx, rslt, cop, _ClassName, _RefLeft, _RefRight, _RefLeftClass, _RefRightClass, 1, 0) )
+ CmpiObjectPath csop = get_this_computersystem(*broker, ctx, cop);
+ bool ret = assoc_create_refs_1toN( *broker, ctx, rslt, csop,
+ _ClassName,_RefLeft,_RefRight,
+ _RefLeftClass,_RefRightClass,0,0);
+ if(!ret)
{
CmpiStatus st( CMPI_RC_ERR_FAILED, "EnumInstanceNames failed." );
return st;
}
-
+
rslt.returnDone();
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() exited",_ClassName));
return CmpiStatus(CMPI_RC_OK);
@@ -56,12 +60,16 @@ namespace cmpizypp
{
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() called",_ClassName));
- if(!assoc_create_inst_1toN( *broker, ctx, rslt, cop, _ClassName, _RefLeft, _RefRight, _RefLeftClass, _RefRightClass, 1, 1) )
+ CmpiObjectPath csop = get_this_computersystem(*broker, ctx, cop);
+ bool ret = assoc_create_refs_1toN( *broker, ctx, rslt, csop,
+ _ClassName,_RefLeft,_RefRight,
+ _RefLeftClass,_RefRightClass,1,0);
+ if(!ret)
{
CmpiStatus st( CMPI_RC_ERR_FAILED, "EnumInstances failed." );
return st;
}
-
+
rslt.returnDone();
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() exited",_ClassName));
return CmpiStatus(CMPI_RC_OK);
diff --git a/src/SUSE_InstalledSoftwareIdentityProvider.cc b/src/SUSE_InstalledSoftwareIdentityProvider.cc
index d2c4fea..bd2d30c 100644
--- a/src/SUSE_InstalledSoftwareIdentityProvider.cc
+++ b/src/SUSE_InstalledSoftwareIdentityProvider.cc
@@ -42,6 +42,8 @@ namespace cmpizypp
{
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() called",_ClassName));
+ CmpiObjectPath csop = get_this_computersystem(*broker, ctx, cop);
+
// zypp init
zypp::scoped_ptr<ZyppAC> zyppac;
try
@@ -55,46 +57,26 @@ namespace cmpizypp
return rc;
}
- CmpiObjectPath op(cop.getNameSpace(), _RefRightClass); // CIM_System
- if( op.isNull() )
- {
- CmpiStatus st( CMPI_RC_ERR_FAILED, "Create CMPIObjectPath failed.");
- _CMPIZYPP_TRACE(1,("--- enumInstanceNames() failed: %s", st.msg() ) );
- return st;
- }
- CmpiEnumeration en = broker->enumInstanceNames( ctx, op );
- if( en.isNull() )
- {
- CmpiStatus st( CMPI_RC_ERR_FAILED, "EnumInstanceNames failed.");
- _CMPIZYPP_TRACE(1,("--- enumInstanceNames() failed: %s", st.msg() ) );
- return st;
- }
-
CmpiObjectPath rop( cop.getNameSpace(), _ClassName );
- while( en.hasNext() )
+ ResPool pool( zyppac->pool() );
+ for_( it, pool.begin(), pool.end() )
{
- CmpiData data = en.getNext();
+ if( !(*it).status().isInstalled() )
+ continue;
- ResPool pool( zyppac->pool() );
- for_( it, pool.begin(), pool.end() )
+ CmpiObjectPath iop = SUSE_SoftwareIdentityProviderClass::makeSoftwareIdentityOP(*it, *zyppac, cop);
+ CmpiInstance ci( rop );
+ if( ci.isNull() )
{
- if( !(*it).status().isInstalled() )
- continue;
-
- CmpiObjectPath iop = SUSE_SoftwareIdentityProviderClass::makeSoftwareIdentityOP(*it, *zyppac, cop);
- CmpiInstance ci( rop );
- if( ci.isNull() )
- {
- return CmpiStatus(CMPI_RC_ERR_FAILED, "Create CmpiInstance failed.");
- }
- ci.setProperty( _RefLeft, iop );
- ci.setProperty( _RefRight, data );
-
- CmpiObjectPath tmp = ci.getObjectPath();
- tmp.setNameSpace(cop.getNameSpace());
- rslt.returnData(tmp);
+ return CmpiStatus(CMPI_RC_ERR_FAILED, "Create CmpiInstance failed.");
}
+ ci.setProperty( _RefLeft, iop );
+ ci.setProperty( _RefRight, csop );
+
+ CmpiObjectPath tmp = ci.getObjectPath();
+ tmp.setNameSpace(cop.getNameSpace());
+ rslt.returnData(tmp);
}
rslt.returnDone();
@@ -106,6 +88,8 @@ namespace cmpizypp
{
_CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() called",_ClassName));
+ CmpiObjectPath csop = get_this_computersystem(*broker, ctx, cop);
+
// zypp init
zypp::scoped_ptr<ZyppAC> zyppac;
try
@@ -119,44 +103,23 @@ namespace cmpizypp
return rc;
}
- CmpiObjectPath op(cop.getNameSpace(), _RefRightClass); // CIM_System
- if( op.isNull() )
- {
- CmpiStatus st( CMPI_RC_ERR_FAILED, "Create CMPIObjectPath failed.");
- _CMPIZYPP_TRACE(1,("--- enumInstanceNames() failed: %s", st.msg() ) );
- return st;
- }
- CmpiEnumeration en = broker->enumInstanceNames( ctx, op );
- if( en.isNull() )
- {
- CmpiStatus st( CMPI_RC_ERR_FAILED, "EnumInstanceNames failed.");
- _CMPIZYPP_TRACE(1,("--- enumInstanceNames() failed: %s", st.msg() ) );
- return st;
- }
-
CmpiObjectPath rop( cop.getNameSpace(), _ClassName );
-
- while( en.hasNext() )
+ ResPool pool( zyppac->pool() );
+ for_( it, pool.begin(), pool.end() )
{
- CmpiData data = en.getNext();
+ if( !(*it).status().isInstalled() )
+ continue;
- ResPool pool( zyppac->pool() );
- for_( it, pool.begin(), pool.end() )
+ CmpiObjectPath iop = SUSE_SoftwareIdentityProviderClass::makeSoftwareIdentityOP(*it, *zyppac, cop);
+ CmpiInstance ci( rop );
+ if( ci.isNull() )
{
- if( !(*it).status().isInstalled() )
- continue;
-
- CmpiObjectPath iop = SUSE_SoftwareIdentityProviderClass::makeSoftwareIdentityOP(*it, *zyppac, cop);
- CmpiInstance ci( rop );
- if( ci.isNull() )
- {
- return CmpiStatus(CMPI_RC_ERR_FAILED, "Create CmpiInstance failed.");
- }
- ci.setProperty( _RefLeft, iop );
- ci.setProperty( _RefRight, data );
-
- rslt.returnData(ci);
+ return CmpiStatus(CMPI_RC_ERR_FAILED, "Create CmpiInstance failed.");
}
+ ci.setProperty( _RefLeft, iop );
+ ci.setProperty( _RefRight, csop );
+
+ rslt.returnData(ci);
}
rslt.returnDone();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org