Re: can not set up wrapper for module: nimclient

Xander Cage <[email protected]> Thu, 4 Jul 2024 07:09:50 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
i took a look at cf-agent/package_module.c...

static int NegotiateSupportedAPIVersion(PackageModuleWrapper *wrapper)
{
    assert(wrapper);

    Log(LOG_LEVEL_DEBUG, "Getting supported API version.");

    int api_version = -1;

    Rlist *response = NULL;
    if (PackageWrapperCommunicate(wrapper, "supports-api-version", "",
                                  &response) != 0)
    {
        Log(LOG_LEVEL_INFO,
            "Error occurred while getting supported API version.");
        return -1;
    }

    if (response)
    {
        if (RlistLen(response) == 1)
        {
            api_version = atoi(RlistScalarValue(response));
            Log(LOG_LEVEL_DEBUG, "package wrapper API version: %d", 
api_version);
        }
        RlistDestroy(response);
    }
    return api_version;
}


this looks somewhat "weird" to me...

if (PackageWrapperCommunicate(wrapper, "supports-api-version", "",
                                  &response) != 0) 

isnt the returned "1" from the module also not "0", so its always an error  
except the module returns "0"?

On Thursday, July 4, 2024 at 2:57:49 PM UTC+2 Xander Cage wrote:

> changing the mock part to this fixes the related error...successfully 
> stolen from the pksrc module...
>
> if [ -n "$CFENGINE_TEST_NIMCLIENT_MOCK" ]; then
>
> still no idea concerning the api check...
>
> On Thursday, July 4, 2024 at 2:39:17 PM UTC+2 Xander Cage wrote:
>
>> seems this part in the nimclient script is not working, hence the " cat: 
>> cannot open ../../tests/unit/mock_lslpp_Lc " error...
>>
>> # Set up mock environment if necessary
>> # This is not well developed as I don't have continuous access to aix and 
>> nim
>> # nor am I an expert
>> CFENGINE_TEST_NIMCLIENT_MOCK=false
>> if [ -n "$CFENGINE_TEST_NIMCLIENT_MOCK"  = "true" ]; then
>>     list_installed_packages() {
>>         cat ../../tests/unit/mock_lslpp_Lc
>>      }
>>     nimclient_showres() {
>>         # This lists the AVAILABLE packages in the nim repo
>>         cat ../../tests/unit/mock_nimclient_showres
>>     }
>>     nimclient_install_package() {
>>         # Ugh, not sure what this should do to mock. I think that 
>> nimclient
>>         # return codes kind of suck, might need to parse the output?
>>         echo nimclient -o cust -a lpp_source=${lpp_source} -a 
>> filesets=\"${Name}\" >&2
>>     }
>>     remove_package() {
>>         echo installp -u "${Name}" >&2
>>     }
>> else
>>     list_installed_packages() {
>>         lslpp -Lc
>>     }
>>     nimclient_showres() {
>>         /usr/sbin/nimclient -o showres -a resource=${lpp_source} -a 
>> installp_flags=L
>>     }
>>     nimclient_install_package() {
>>         /usr/sbin/nimclient -o cust -a lpp_source=${lpp_source} -a 
>> filesets=\"${Name}\" 1>&2
>>     }
>>     remove_package() {
>>         installp -u "${Name}" 1>&2
>>     }
>> fi
>>
>> no idea why CFENGINE_TEST_NIMCLIENT_MOCK=false is not evaluated 
>> correctly...
>>
>> same for this part...
>>
>> supports_api_version () {
>>     echo 1
>> }
>>
>> should work, but fails...strange
>>
>>
>>
>>
>>
>> On Thursday, July 4, 2024 at 12:20:43 PM UTC+2 Xander Cage wrote:
>>
>>> fun fact...i noticed on some clients the error changed to this after 
>>> upgrading binaries...
>>>
>>> cat: cannot open ../../tests/unit/mock_lslpp_Lc
>>>
>>> On Thursday, July 4, 2024 at 12:13:56 PM UTC+2 Xander Cage wrote:
>>>
>>>> upgrade binaries to 3.21.5...error persists
>>>>
>>>> On Thursday, July 4, 2024 at 11:08:06 AM UTC+2 Xander Cage wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> after upgrading masterfiles to 3.21.5 cf-agent spills this error...
>>>>>
>>>>> Q: ".../cf-agent" --de":    error: Unsupported package module wrapper 
>>>>> API version: -1
>>>>> Q: ".../cf-agent" --de":    error: Can not set up wrapper for module: 
>>>>> nimclient
>>>>>
>>>>> agent is still on 3.21.4...maybe this is the root cause of this...
>>>>>
>>>>> chris
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/98ff06dc-e252-49b7-9f50-d5f17c155f3bn%40googlegroups.com.