spurin / diveintokcna

Dive Into Containers, Kubernetes and the Kubernetes Cloud Native Associate Certification
33 stars 11 forks source link

[Lab Issue]: Sync Lesson Environment - partial command execution error #27

Closed rajesamp closed 6 months ago

rajesamp commented 7 months ago

How is the lab being run?

Docker Desktop Extension

Operating System

Mac Sonoma 14.2.1

Browser

CHROME

Lab Details

SYNC Lesson Environment

Issue Description

When clicked on Sync Lesson Environment, it doesn't budge for the initial command "cd" error , as it starts in same line and command becomes invalid. Eg:In terminal you have start type a command and click on Sync Lesson Environment, it attempts to run from the same line. Image 3-3-24 at 11 01 AM Image 3-3-24 at 11 01 AM (1)

root@control-plane:~# kubectl cd; /resources/catchup removek3s error: unknown command "cd" for "kubectl"

Did you mean this? cp Resetting and re-running previous steps, script called with removek3s - executing ansible with tag removek3s,clean ...`

Solution: In order to avoid test check on first line command "$? -eq 0", in your script please add echo -e "\n"

This will ensure that the script always begins on a new line, preventing partial command execution

Additional Feedback

Such a wonderful contents on Docker, Kubernetes - with Hollywood level animation, loving every single byte of it

spurin commented 7 months ago

Thanks so much @rajesamp really appreciate your kind words! - if I'm understanding this correctly, the enhancement you're looking for on this would be the sync button, sending a carriage return before it attempts to run the sync command.

Therefore, if it's not an empty line, i.e.

kubectl

It will action -

kubectl <carriage return, we ignore the error> <cd; followed by command to sync lesson>

So regardless of if the command line is empty or not, the sync button will work?

Is that correct

rajesamp commented 7 months ago

yes exactly @spurin . I stumbled up on this issue which I was trying to run a kubectl cmd but I wanted to sync lesson environment while I was in same line without command completion, that's when this bug appeared.

spurin commented 7 months ago

Brilliant!

I will see if I can send a ctrl-c before the update. Will confirm how I get on in this issue.

Very much appreciate your time and efforts in making me aware of this.

rajesamp commented 7 months ago

Thanks for your response. I’m eager to see how this solution rolls out as wellSent from my iPhoneOn Mar 3, 2024, at 1:42 PM, James Spurin @.***> wrote: Brilliant! I will see if I can send a ctrl-c before the update. Will confirm how I get on in this issue. Very much appreciate your time and efforts in making me aware of this.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

spurin commented 6 months ago

This is complete, thanks @rajesamp for the feedback. Next time the lab is updated, this will be in place.

image