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

Remove language default and fix command flags #170

Merged
merged 1 commit into from
Oct 23, 2017
Merged

Remove language default and fix command flags #170

merged 1 commit into from
Oct 23, 2017

Conversation

johnmccabe
Copy link
Contributor

@johnmccabe johnmccabe commented Oct 15, 2017

Description

This PR stops using node as a default language due to it conflicting with functions where the fprocessenvvar is set in the image.

Given the large numbers of languages having a default makes less sense now.

It also removes some of the copy-paste/redundant/irrelevant flag definitions that ended up in newly added subcommands.

Motivation and Context

How Has This Been Tested?

  1. Have run deploy, build, invoke and list commands without problem.
  2. Run a deploy with no --fprocess flag, function gets created with one being set as expected and correctly honours the setting in the image.
  3. Ran a build with --lang set and successfully built and deployed (used the first-faas-python-function guide as a test run).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Strictly speaking this is a breaking change, but it only impacts a very small edge case - that is where you deploy node functions via the CLI and rely on the language being set to node by default.

As mentioned above, the growing number of function languages means that for the vast majority of users this won't be an issue and I think we're better having a single common behaviour for all users - which for the moment should include setting the language flag --lang.

Note that the logic setting a default fprocess when a language is set has not changed and remains useful.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@open-derek
Copy link

open-derek bot commented Oct 15, 2017

Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off.
That's something we need before your Pull Request can be merged. Please see our contributing guide.

@open-derek open-derek bot added no-dco and removed no-dco labels Oct 15, 2017
@johnmccabe
Copy link
Contributor Author

@rgee0 this should fix the bug you'd spotted when looking at openfaas/faas#297

@@ -159,6 +159,7 @@ func runDeploy(cmd *cobra.Command, args []string) {
os.Exit(1)
}

fmt.Printf("GOING IN: %s, %s, %s, %s, %s\n", fprocess, gateway, functionName, image, language)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a stray debug line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I saw it come up in the git diff, but it wasn't there in the editor pane, assumed VSCode was playing up - but yep, will nuke.

@rgee0
Copy link
Contributor

rgee0 commented Oct 15, 2017

I’ll try to give it a run out tomorrow

This commit stops using `node` as a default language due to it
conflicting with functions where the `fprocess` is set in the image.

Given the large numbers of languages having a default makes less sense
now.

It also removes some of the copy-paste/redundant/irrelevant flag
definitions that ended up in newly added subcommands.

Signed-off-by: John McCabe <[email protected]>
@udondan
Copy link

udondan commented Oct 16, 2017

Confirming this fixes the problem, thanks John!


```
$ faas-cli build \
--image=alexellis2/node_info \
--lang= node \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an extra space here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnmccabe can you push this fixed? ^ extra space between = and node

@@ -26,7 +26,7 @@ func init() {
buildCmd.Flags().StringVar(&image, "image", "", "Docker image name to build")
buildCmd.Flags().StringVar(&handler, "handler", "", "Directory with handler for function, e.g. handler.js")
buildCmd.Flags().StringVar(&functionName, "name", "", "Name of the deployed function")
buildCmd.Flags().StringVar(&language, "lang", "node", "Programming language template")
buildCmd.Flags().StringVar(&language, "lang", "", "Programming language template")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good edit.

@@ -15,18 +15,15 @@ import (
)

var (
verboseInvoke bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to verboseInvoke?

@@ -18,12 +18,7 @@ var (

func init() {
// Setup flags that are used by multiple commands (variables defined in faas.go)
listCmd.Flags().StringVar(&fprocess, "fprocess", "", "Fprocess to be run by the watchdog")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good refactor.

Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you John. Looking forward to merging this. Just a minor nit.

@alexellis alexellis merged commit 1d336ee into openfaas:master Oct 23, 2017
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

Successfully merging this pull request may close these issues.

4 participants