Giter VIP home page Giter VIP logo

Comments (4)

jw-msft avatar jw-msft commented on June 28, 2024 1

Summary

The first is trying to deep copy handlerProperties from the update manifest, which is needed by apt content handler. In fact, it needs "installedCriteria" property in the handlerProperties.

Resolution

The update manifest from the logs shows there is no "handlerProperties" property for step 0:

    "instructions": {
        "steps": [
            {
                "handler": "microsoft\/apt:1",
                "files": [
                    "fb42001e3d0d13a3b"
                ]
            }
        ]
    }

Instead, the import manifest should have something like:

    "instructions": {
        "steps": [
            {
                "handler": "microsoft\/apt:1",
                "handlerProperties": {
                    "installedCriteria": "1.0"
                },
                "files": [
                    "fb42001e3d0d13a3b"
                ]
            }
        ]
    }

Explanation

It uses "installedCriteria" to determine if the update needs to be installed or not. Ideally, the APT content handler should query APT/dpkg to determine if the packages in the apt manifest are installed or not, but since it can be set of package adds and deletions (by prefixing - to the package name), opted for the existing "installedCriteria" concept, which is an abstract version that is not related to the packages or individual package versions.

When apt packages are installed (or removed if - prefix is used in apt manifest), then it appends a file at /var/lib/adu/installedcriteria with the latest installed installedCriteria. To determine if IsInstalled is true, it will look to see if the current installedCriteria exists in this file.

Possibly Confusing Documentation

https://learn.microsoft.com/en-us/azure/iot-hub-device-update/import-schema#inlinestep-object that shows handlerProperties is not required which is true in general for a custom content handler, but for APT and other 1st party content handlers, they require at least this:

"handlerProperties": {
    "installedCriteria": "1.0"
},

We're looking into how to make this less confusing.

Detailed Analysis

-2143289331 is hex ffff ffff 8040 000d

which from https://github.com/Azure/iot-hub-device-update/blob/main/src/inc/aduc/result.h#L1321 is:
/**

  • @brief ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED, ERC Value: 2151677965 (0x8040000d)
    */
    #define ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED MAKE_ADUC_EXTENDEDRESULTCODE_FOR_COMPONENT_ADUC_COMPONENT_WORKFLOW_UTIL(13)

From steps-handler.20221103-155849.log:

2022-11-03T15:58:49.3607Z 713[713] [E] Cannot copy 'handlerProperties'. [workflow_create_from_inline_step]
2022-11-03T15:58:49.3607Z 713[713] [E] ERROR: failed to create workflow for level:0 step#0. [PrepareStepsWorkflowDataObject]

This corresponds to code in

result.ExtendedResultCode = ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED;

where it is trying to copy "handlerProperties" property.

from iot-hub-device-update.

PedroBuhigas avatar PedroBuhigas commented on June 28, 2024 1

Summary

The first is trying to deep copy handlerProperties from the update manifest, which is needed by apt content handler. In fact, it needs "installedCriteria" property in the handlerProperties.

Resolution

The update manifest from the logs shows there is no "handlerProperties" property for step 0:

    "instructions": {
        "steps": [
            {
                "handler": "microsoft\/apt:1",
                "files": [
                    "fb42001e3d0d13a3b"
                ]
            }
        ]
    }

Instead, the import manifest should have something like:

    "instructions": {
        "steps": [
            {
                "handler": "microsoft\/apt:1",
                "handlerProperties": {
                    "installedCriteria": "1.0"
                },
                "files": [
                    "fb42001e3d0d13a3b"
                ]
            }
        ]
    }

Explanation

It uses "installedCriteria" to determine if the update needs to be installed or not. Ideally, the APT content handler should query APT/dpkg to determine if the packages in the apt manifest are installed or not, but since it can be set of package adds and deletions (by prefixing - to the package name), opted for the existing "installedCriteria" concept, which is an abstract version that is not related to the packages or individual package versions.

When apt packages are installed (or removed if - prefix is used in apt manifest), then it appends a file at /var/lib/adu/installedcriteria with the latest installed installedCriteria. To determine if IsInstalled is true, it will look to see if the current installedCriteria exists in this file.

Possibly Confusing Documentation

https://learn.microsoft.com/en-us/azure/iot-hub-device-update/import-schema#inlinestep-object that shows handlerProperties is not required which is true in general for a custom content handler, but for APT and other 1st party content handlers, they require at least this:

"handlerProperties": {
    "installedCriteria": "1.0"
},

We're looking into how to make this less confusing.

Detailed Analysis

-2143289331 is hex ffff ffff 8040 000d

which from https://github.com/Azure/iot-hub-device-update/blob/main/src/inc/aduc/result.h#L1321 is: /**

  • @brief ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED, ERC Value: 2151677965 (0x8040000d)
    */
    #define ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED MAKE_ADUC_EXTENDEDRESULTCODE_FOR_COMPONENT_ADUC_COMPONENT_WORKFLOW_UTIL(13)

From steps-handler.20221103-155849.log:

2022-11-03T15:58:49.3607Z 713[713] [E] Cannot copy 'handlerProperties'. [workflow_create_from_inline_step]
2022-11-03T15:58:49.3607Z 713[713] [E] ERROR: failed to create workflow for level:0 step#0. [PrepareStepsWorkflowDataObject]

This corresponds to code in

result.ExtendedResultCode = ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED;

where it is trying to copy "handlerProperties" property.

Thank you very much for the detailed response. I used the az cli to create the update manifest, perhaps additional logic is needed there to properly create the manifest file with all required properties. I also noticed due to fat fingering that you can set an invalid update handler via the CLI.

I'll try this and let you know results.

from iot-hub-device-update.

PedroBuhigas avatar PedroBuhigas commented on June 28, 2024 1

It's working as expected - Thank you

from iot-hub-device-update.

jw-msft avatar jw-msft commented on June 28, 2024

Glad it's working. Cheers!

from iot-hub-device-update.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.