def execute()

in aws_lambda_builders/workflows/dotnet_clipackage/actions.py [0:0]


    def execute(self):
        # run Amazon.Lambda.Tools update in sync block in case build is triggered in parallel
        with GlobalToolInstallAction.__lock:
            LOG.debug("Entered synchronized block for updating Amazon.Lambda.Tools")

            # check if Amazon.Lambda.Tools updated recently
            if GlobalToolInstallAction.__tools_installed:
                LOG.info("Skipping to update Amazon.Lambda.Tools install/update, since it is updated recently")
                return

            try:
                LOG.debug("Installing Amazon.Lambda.Tools Global Tool")
                self.subprocess_dotnet.run(["tool", "install", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"])
                GlobalToolInstallAction.__tools_installed = True
            except DotnetCLIExecutionError:
                LOG.debug("Error installing probably due to already installed. Attempt to update to latest version.")
                try:
                    self.subprocess_dotnet.run(
                        ["tool", "update", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"]
                    )
                    GlobalToolInstallAction.__tools_installed = True
                except DotnetCLIExecutionError as ex:
                    raise ActionFailedError(
                        "Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: " + str(ex)
                    )