Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Use pull-secret API and ask for copy-paste #102

Merged
merged 4 commits into from
Jul 26, 2021

Conversation

gbraad
Copy link
Contributor

@gbraad gbraad commented Jul 13, 2021

Fixes: #99 and #100
Implemented according to: crc-org/crc#2561
Remaining discussion: crc-org/crc#2571 (what to do in case file is given)


When no pull-secret exists, a pullsecret dialog is shown. When pasted and confirmed, it is stored in the Credential Manager.

From Settings it is possible to change the pull-secret. Is stored when applied.

@gbraad gbraad requested a review from anjannath July 13, 2021 08:22
@gbraad gbraad changed the title [WIP] Use pull-secret API [WIP] Use pull-secret API and ask for copy-paste Jul 13, 2021
@gbraad gbraad changed the title [WIP] Use pull-secret API and ask for copy-paste Use pull-secret API and ask for copy-paste Jul 13, 2021
String.Empty,
String.Empty,
String.Empty);

if(configs == null)
if (!pullsecret)
Copy link
Member

Choose a reason for hiding this comment

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

This check is not working as expected, the pull-secret prompt always appears when you click on start even when its already saved in the credential store

Copy link
Member

Choose a reason for hiding this comment

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

If the pull secret is not stored the api returns a 404 http status not found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll have to check this, but this always returns false? The idea is that an exception returns a default typed result. I see that the 200, does not return any value, so this means the bool type will therefore have no value.

return getResultsForBasicCommand<bool>(BasicCommands.PullSecret);

@gbraad
Copy link
Contributor Author

gbraad commented Jul 19, 2021

@anjannath did this work? else we have to take this into the next sprint

@anjannath
Copy link
Member

@gbraad Now getting unhandled exceptions when clicking on start :(

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> CRCTray.Communication.NotFoundException
   at CRCTray.Communication.DaemonCommander.<getResponse>d__17.MoveNext()
   --- End of inner exception stack trace ---
   at System.AggregateException.Handle(Func`2 predicate)
   at CRCTray.Helpers.TaskHelpers.<TryTaskAndNotify>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at CRCTray.CRCTray.<StartMenu_Click>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at CRCTray.Program.Main()
level=error msg="stdin is closed, shutdown..."
The program '[14176] crc-tray.exe' has exited with code 0 (0x0).

@gbraad
Copy link
Contributor Author

gbraad commented Jul 19, 2021

Haven't been able to test/work on this.
Functionality isn't defective, just would be improved.

Defer to next sprint


AggregateException was thrown instead, containing the APINotFound

@anjannath anjannath changed the title Use pull-secret API and ask for copy-paste [WIP] Use pull-secret API and ask for copy-paste Jul 19, 2021
@gbraad gbraad changed the title [WIP] Use pull-secret API and ask for copy-paste Use pull-secret API and ask for copy-paste Jul 20, 2021
@anjannath
Copy link
Member

@gbraad Will test this today

@gbraad gbraad requested a review from anjannath July 20, 2021 07:03
@gbraad gbraad added the enhancement New feature or request label Jul 20, 2021
@gbraad gbraad linked an issue Jul 20, 2021 that may be closed by this pull request
@gbraad
Copy link
Contributor Author

gbraad commented Jul 21, 2021

Please check the alignment in the settings window; have a local change that makes no sense.
Seems the WSL2 environment acts up again. Changes are correctly there.

@anjannath
Copy link
Member

New settings windows looks like below:
image

@anjannath anjannath merged commit 5cb8803 into crc-org:master Jul 26, 2021
@gbraad
Copy link
Contributor Author

gbraad commented Jul 26, 2021

@anjannnath now to decide what to do on the macOS side about the 'file' option: crc-org/tray-macos#120

@gbraad gbraad deleted the pull-secret-api branch July 26, 2021 06:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change pull-secret check to use API Implement dialog with paste option for the pull-secret
2 participants