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

feat(instance): import file for cloud-init #1525

Merged
merged 10 commits into from
May 28, 2021

Conversation

jtherin
Copy link
Member

@jtherin jtherin commented Nov 12, 2020

Add support of file import for cloud-init
$ scw instance server create image=ubuntu_focal name=test cloud-init=@/tmp/test

Sh4d1
Sh4d1 previously approved these changes Nov 12, 2020
Copy link
Contributor

@Sh4d1 Sh4d1 left a comment

Choose a reason for hiding this comment

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

LGTM

@jtherin jtherin force-pushed the importfile branch 2 times, most recently from 98dd3fb to 53c1749 Compare November 13, 2020 12:25
Sh4d1
Sh4d1 previously approved these changes Nov 13, 2020
Copy link
Contributor

@Sh4d1 Sh4d1 left a comment

Choose a reason for hiding this comment

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

LGTM

@jtherin
Copy link
Member Author

jtherin commented Nov 17, 2020

Reimplemented using ArgSpecs.

@jtherin
Copy link
Member Author

jtherin commented Nov 17, 2020

Hmm, seems not working on user-data, will investigate tomorrow.

Copy link
Contributor

@jerome-quere jerome-quere left a comment

Choose a reason for hiding this comment

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

We should also:

  • Add a least on test in the core package
  • Add documentation for flag that have CanLoadFile: true
  • Handle Autocompletion (maybe in another MR , if so we need an issue)

}

for _, v := range fieldValues {
if v.Kind() != reflect.String {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about StringPointer ? is it handled in getValuesForFieldByName ?

@QuentinBrosse
Copy link
Contributor

Add documentation for flags that have CanLoadFile: true

@jtherin can you please add at least an example too 🙏

@remyleone remyleone linked an issue Nov 23, 2020 that may be closed by this pull request
fieldName := strcase.ToPublicGoName(argSpec.Name)
fieldValues, err := getValuesForFieldByName(reflect.ValueOf(cmdArgs), strings.Split(fieldName, "."))
if err != nil {
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should return an error and not fail silently ?

Copy link
Member Author

Choose a reason for hiding this comment

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

validate.go line 48 et 78 also execute getValuesForFieldByName, log an info and continue.
It would not be too much to log the same info many times ?

Copy link
Contributor

@jerome-quere jerome-quere left a comment

Choose a reason for hiding this comment

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

see coment

@remyleone remyleone merged commit cd7e8e8 into scaleway:master May 28, 2021
@remyleone remyleone added the instance Instance issues, bugs and feature requests label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
instance Instance issues, bugs and feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot set user-data content from file Improve scw instance server [create|update] cloud-init argument
5 participants