faas-cli
faas-cli copied to clipboard
Append flag doesnt add newline if not present in file
Expected Behaviour
The append flag shuld a function correctly if the file doesn't have a newline at the end
Current Behaviour
When using faas-cli new --append stack.yml
i have found that this doesnt append a newline if one is not present in the file
I therefore created a new function and it appended like this
route53:
lang: golang-middleware
handler: ./route53
image: route53:latest route54: # <-- appended to here without newline
lang: golang-middleware
handler: ./route54
image: route54:latest
Possible Solution
check the stack file for a newline, if not present add one?
Steps to Reproduce (for bugs)
- faas-cli new --lang golang new -f stack.yml
- remove newlines from the stack.yml
- faas-cli new --lang golang new2 --append stack.yml
- check file, its not added a newline before the func so its squashed the the last line of the first definition
Context
Your Environment
- FaaS-CLI version ( Full output from:
faas-cli version
):
___ _____ ____
/ _ \ _ __ ___ _ __ | ___|_ _ __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) | __/ | | | _| (_| | (_| |___) |
\___/| .__/ \___|_| |_|_| \__,_|\__,_|____/
|_|
CLI:
commit: 598336a0cad38a79d5466e6a3a9aebab4fc61ba9
version: 0.12.21
Error with YAML file
- Operating System and version (e.g. Linux, Windows, MacOS): Linux
@Waterdrips I'm going to assign this one to you, can you send a PR and a unit test when you have time.
/add label: help wanted
I'm willing to attempt to fix this one.
Thanks @jantytgat
Hi, I'll take a peek at this issue Saturday evening (11/6). I figure it may already be fixed or still need fixin'...either way I'll let you know. :+1:
Thank you @kylos101 :muscle:
Hi, it's definitely still an issue, I was able to recreate using the instructions in this issue.
I started a fix last night, and will share a draft later today.
Evening :wave: , the :wrench: for this should be all set in #902 , let me know if any changes are needed? :+1: :+1:
Hey @alexellis , may I ask for you to take a peek at #902, and let me know if you'd like anything else?
I tested in Linux and Windows, wrote new unit tests (hooray, coverage!), and asserted no existing tests are broken.
I did take a look already and commented.
I'll add it to the project view so it doesn't keep getting bumped off my radar.
https://github.com/orgs/openfaas/projects/5
Hey @alexellis , I might be missing something... :worried:
I thought I addressed your comments from the initial review 21 days ago in a52cd2b. Can you share any feedback that I have not addressed / you would like me to do (a link is okay too)? :+1: :+1:
Nvm, I get it now, we're working from a Github project - cool. I'll follow-up in #contributors.
Hey @alexellis :wave:
This one should be all set now :partying_face: :tada:
Lemme know if anything else is needed?