chetan_tiwary
Mission Specialist
Mission Specialist
  • 188 Views

Re: LAB 280 - Unable to save file through OC edit command

Hello , 

can you try with vi editor for once and see if it helps ?

 

#OC_EDITOR=vi oc edit deployment/hello

0 Kudos
Reply
Loading...
post2tr
Mission Specialist
Mission Specialist
  • 171 Views

Re: LAB 280 - Unable to save file through OC edit command

Hi,

issue get resolved now !! i should have checked the error reported while it not saving and storing the file to /tmp/oc-edit-XXX ( screenshots attached ) DO280_Chapter-6_GE2_yaml_error.PNG

YAML error: found character that cannot start any token

used tab instead of Space - as Yaml dont accept tabs and expecting spaces

DO280_Chapter-6_GE3.PNG

Thanks for your support !!

 

 

Reply
Loading...
chetan_tiwary
Mission Specialist
Mission Specialist
  • 168 Views

Re: LAB 280 - Unable to save file through OC edit command

Great !! All the Best !

0 Kudos
Reply
Loading...
flozano
Moderator
Moderator
  • 148 Views

Re: LAB 280 - Unable to save file through OC edit command

Clarification comment: oc edit does not save anything anywhere. You will not find a file with the oc edit contents of you last session. It reads from OpenShift and sends back to OpenShift, if OpenShift doesn't likes what it got and rejects it, you are left with no "file" to look at and make fixes.

An alternative is to export the resource to a file, edit the file, and them send it back to OpenShift:

$ oc get kind/name > resource.yaml

$ vi resource.yaml

$ oc apply resource.yaml

 

Reply
Loading...
post2tr
Mission Specialist
Mission Specialist
  • 141 Views

Re: LAB 280 - Unable to save file through OC edit command

hi , 

refer the screenshot for the oc edit  - which shows the change is not accepted and the file get saved /tmp/ 

 

DO280_Chapter-6_GE.PNG

 

Reply
Loading...
flozano
Moderator
Moderator
  • 138 Views

Re: LAB 280 - Unable to save file through OC edit command

You are correct that the file is saved on tmp (so it can be fed to vi or another editor) but oc edit will not pick that file for you and reuse it. So "conceptually" it is not saved... not to mention that any content in tmp could disappear without notice.

But you could fech the file from tmp, edit it, and feed it into oc apply.

Reply
Loading...
post2tr
Mission Specialist
Mission Specialist
  • 125 Views

Re: LAB 280 - Unable to save file through OC edit command

Yes , ofcourse oc edit wont pick . But i mentioned the output is save to /tmp/ by oc edit when it rejects the changes .So conceptually its save :-) anyway ..  thanks for your sharing !! cheers

Reply
Loading...
Igris
Mission Specialist
Mission Specialist
  • 110 Views

Re: LAB 280 - Unable to save file through OC edit command

a bit late to the patry but i hit the same issue,

the problem is with the indentation if you dont indent properly (mashing space)

it wont save so it doesnt matter if you export it as yaml or not if you dont have proper indentation openshift will not accept it .

0 Kudos
Reply
Loading...
Igris
Mission Specialist
Mission Specialist
  • 105 Views

Re: LAB 280 - Unable to save file through OC edit command

since the topic is already bumped i have another question for the particular exercise 

oc delete all -l app=hello-limit

where is that label app stored ? and how can i view other labels ? I checked if it was on the node but that was not the case.

0 Kudos
Reply
Loading...
flozano
Moderator
Moderator
  • 97 Views

Re: LAB 280 - Unable to save file through OC edit command

All Kubernetes resources store labels as part of their metadata. You can use "oc get kind name -o yaml" to see a complete, raw resource definition and "oc get kind name --show-labels" to see just labels

The app label used to be standard in apps created by oc new-app but with recent releases of OpenShift it might not be created for all scenarios. Developers are free to add as many labels they wish for their resources and it is common practice to add a common label to all resources related to an application or service to make it easier to track them.

Reply
Loading...
Join the discussion
You must log in to join this conversation.