Git Product home page Git Product logo

Comments (5)

jstvz avatar jstvz commented on September 27, 2024 2

@prakash-concret Thank you for the reproduction.

Root cause: This is related to a change made to that task as part of #1618 to move to Pydantic-based task option validation framework.

Workaround: The most straightforward workaround is to directly update your task to use parsed_options instead:

diff --git a/tasks/example.py b/tasks/example.py
index f07dc6a..daa2a30 100644
--- a/tasks/example.py
+++ b/tasks/example.py
@@ -50,4 +50,4 @@ class FindReplaceUsername(FindReplace):
         # Run the _init_options logic from FindReplace
         super()._init_options(kwargs)
         # Set the replace option to the org's username
-        self.options["replace"] = self.org_config.username
+        self.parsed_options["replace"] = self.org_config.username

(Not applicable to your use case, but I want to note that some find/replace transforms are available in the deploy task.

from cumulusci.

sahilconcret avatar sahilconcret commented on September 27, 2024 1

@prakash-concret @jstvz Yes this is the issue I am facing and even In 3.75.1 It's working fine.
But versions after that there it is not working as expected.

from cumulusci.

jstvz avatar jstvz commented on September 27, 2024

@sahilconcret This is working as designed. The FindReplace task uses the replace option as a literal replacement. Are you saying that your custom task previously worked as you describe? If so, what was the last version that did so?

from cumulusci.

prakash-concret avatar prakash-concret commented on September 27, 2024

@jstvz you are right, but overriding the option values using a custom Python class is not working.
For Example: Created a Python class to replace username names like this.

from cumulusci.tasks.util import FindReplace as FindReplace

class FindReplaceUsername(FindReplace):
    salesforce_task = True # Require a target org
    
    def _init_options(self, kwargs):
        # Run the _init_options logic from FindReplace
        super()._init_options(kwargs)
        # Set the replace option to the org's username
        self.options["replace"] = self.org_config.username

calling this custom task from cumulusci.yml

find_replace_username:
    description: Replaces a string with the target org's username
    class_path: tasks.util.FindReplaceUsername
    options:
            find: "%%%USERNAME%%%"
            replace: userName
            path: unpackaged/config/cmts/customMetadata

This custom implementation is not working in the new release, in the 3.74.0 version it's working fine.

@sahilconcret Please confirm this is an issue you are facing.

from cumulusci.

sahilconcret avatar sahilconcret commented on September 27, 2024

Thanks @jstvz @prakash-concret for your help.
In versions later that 3.75.1 we need to use self.parsedoptions instead of self.options.
That works perfectly.

from cumulusci.

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.