-
Notifications
You must be signed in to change notification settings - Fork 284
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
Implement rdctl create-profile [ --input FILE | --body JSON | --from-settings ]
#5021
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding --body
and --input
options to list-settings
doesn't make any sense; it should always fetch the current settings from the API.
If we want to have this general conversion functionality (and I do think that this is useful to have), then it needs to be a separate command.
Let's hash out the design of those commands first before working on the implementation.
I agree that it doesn't make sense for I don't see how |
cb6bd7b
to
17e6b3b
Compare
I agree, but removing stuff in an editor is still easier than writing a JSON input file manually. So I would still use the preferences dialog to set all the desired settings, export them into reg or plist format, and then just remove things I don't intend to lock down. For the defaults profile it doesn't even matter; you can leave everything in. The defaults are only applied during first-run anyways. |
17e6b3b
to
0bbcc5d
Compare
59ce8b1
to
8b652c4
Compare
e353a8c
to
69c18a0
Compare
3d9fd01
to
8a3cb6b
Compare
4276f4d
to
07445dd
Compare
b8b7925
to
628622b
Compare
d346c31
to
6086479
Compare
6086479
to
cfae438
Compare
rdctl list-settings
rdctl create-profile [ --input FILE | --body JSON | --from-settings ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only a partial review of the tests.
I would really like to understand the issue with assert_output
and here-documents because I think a lot of the tests would read better with here-docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of feedback
# Just match a few of the lines near the start and the end of the output. | ||
# The unit tests do more comprehensive output checking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment seems out-dated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm going with full here-doc testing now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check-spelling found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
8328d0d
to
ab6770f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of feedback, based solely on reading through the tests.
src/go/rdctl/cmd/createProfile.go
Outdated
|
||
if outputSettingsFlags.Format == plistFormat { | ||
if outputSettingsFlags.RegistryHive != "" || outputSettingsFlags.RegistryProfileType != "" { | ||
return fmt.Errorf("registry hive and type can't be specified with plist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with quoting of all "values" in other errors:
return fmt.Errorf("registry hive and type can't be specified with plist") | |
return fmt.Errorf(`registry hive and type can't be specified with output "plist"`) |
src/go/rdctl/cmd/createProfile.go
Outdated
case "": | ||
outputSettingsFlags.RegistryProfileType = defaultsType | ||
default: | ||
return fmt.Errorf("invalid registry type of '%s' specified, must be %s or %s", outputSettingsFlags.RegistryProfileType, defaultsType, lockedType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("invalid registry type of '%s' specified, must be %s or %s", outputSettingsFlags.RegistryProfileType, defaultsType, lockedType) | |
return fmt.Errorf(`invalid registry type of "%s" specified, must be "%s" or "%s"`, outputSettingsFlags.RegistryProfileType, defaultsType, lockedType) |
Signed-off-by: Eric Promislow <epromislow@suse.com>
Use double-quoting to quote all terms that need quoting in user-directed messages. Put command-line checking BATs tests before tests that run and check output. Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
On Windows run the output through 'reg import' to verify it's acceptable. Signed-off-by: Eric Promislow <epromislow@suse.com>
- The missing-file error message is different in WSL, so drop the specific part - The `<(function)` form doesn't work on Windows, so use it only on macos-specific tests. Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Ensure that on the bash side we write to `/mnt/DRIVE/tmp`, and on Windows it's `DRIVE:\tmp`` We also have to change the directory name `Policies` to something else because modifying it requires admin privileges, even in HKCU. Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
- Put the bogus namespace in a variable - Use the term 'full settings' for consistency - Have `assert_check_registry_output` use `$output` Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
2d56f35
to
773e658
Compare
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
Signed-off-by: Eric Promislow <epromislow@suse.com>
@test "and shutdown" { | ||
if is_macos; then | ||
rdctl shutdown | ||
fi | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be necessary; we really should look into why this happens for you. Is this specific to using RD_LOCATION=dev
? Because I always use RD_LOCATION=system
, and it doesn't need a shutdown during teardown.
Will approve as is though and create a seoarate issue.
Fixes #5020
This lets users create registry and plist files from either current settings or arbitrary JSON documents.