Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-f / --yaml flag is not honored when creating new functions #906

Closed
1 of 2 tasks
kylos101 opened this issue Nov 21, 2021 · 2 comments
Closed
1 of 2 tasks

-f / --yaml flag is not honored when creating new functions #906

kylos101 opened this issue Nov 21, 2021 · 2 comments

Comments

@kylos101
Copy link

Issue: A yml file is created matching the function name, instead of using the file name, even when the -f or --yaml flag specifies a file name.

Expected Behaviour

faas-cli new func2 --lang go --yaml stack.yml
Folder: func2 created.
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|


Function created in folder: func2
Stack file written: stack.yml

Current Behaviour

faas-cli new func2 --lang go --yaml stack.yml
Folder: func2 created.
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|


Function created in folder: func2
Stack file written: func2.yml

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

  1. Support -f / --yaml flag as optional for new function creation (if not specified use the function name as the file name)
  2. Do not support the flag, consider updating the help text accordingly

Which Solution Do You Recommend?

Supporting the flag

Steps to Reproduce (for bugs)

  1. See expected behavior vs current behavior

Context

I was unit testing #852, and found this flag was not working.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
CLI:
 commit:  b562392b12a78a11bcff9c6fca5a47146ea2ba0a
 version: 0.13.15
  • Docker version ( Full output from: docker version ):
Client: Docker Engine - Community
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:42:59 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:08 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)? Kubernetes

  • Operating System and version (e.g. Linux, Windows, MacOS): Linux

  • Link to your project or a code example to reproduce issue: n/a

@alexellis
Copy link
Member

Hi @kylos101

This is expected behaviour, the flag is not supported to change the name of a new function when the YAML file doesn't exist yet.

However you do have the --append existing-file.yml feature. Would that satisfy the need you had here?

faas-cli new --lang python event-finder
faas-cli new --lang python emailer --append ./event-finder.yml

@kylos101
Copy link
Author

Yes, that'll work nicely. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants