kloudlite / kl

Kloudlite CLI Client
GNU Affero General Public License v3.0
5 stars 1 forks source link

run script error handled #184

Closed nxtcoder36 closed 1 week ago

nxtcoder36 commented 1 week ago

Summary by Sourcery

Handle errors consistently in the runScriptInContainer function by unifying error messages and simplifying the logging logic. Update the Runfile.yml to use a specific tag for image downloads.

Bug Fixes:

Enhancements:

Chores:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This pull request focuses on error handling improvements and code cleanup in the k3s implementation. It also includes a minor change in the Runfile.yml to use a specific version tag.

Class diagram for error handling in k3s implementation

classDiagram
    class client {
        +runScriptInContainer(script string) error
    }
    class fn {
        +NewE(error, string) error
        +Log(string, string)
    }
    class text {
        +Yellow(string) string
        +Blue(string) string
    }
    client --> fn : uses
    client --> text : uses
    note for client "Improved error handling and logging in runScriptInContainer method"

File-Level Changes

Change Details Files
Improved error handling and message consistency
  • Updated error messages for failed exec instance attachments
  • Consolidated duplicate error messages
k3s/impl.go
Refactored container output handling
  • Moved scanner creation outside of the verbose flag check
  • Always process container output, but only log if verbose flag is set
  • Commented out unused code for non-verbose output handling
k3s/impl.go
Updated image download tag in Runfile.yml
  • Changed the tag parameter from a variable to a fixed version 'v1.0.8-nightly'
k3s/k3s-base/Runfile.yml

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).