File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
30
30
runSubscriptionManagerActivationStatus ,
31
31
runSubscriptionManagerRegister ,
32
32
runSubscriptionManagerUnregister ,
33
+ runCreateFactsFile ,
33
34
} from './podman-cli' ;
34
35
import { SubscriptionManagerClient } from '@redhat-developer/rhsm-client' ;
35
36
import { isLinux } from './util' ;
@@ -343,6 +344,10 @@ export async function activate(context: extensionApi.ExtensionContext): Promise<
343
344
await restartPodmanVM ( ) ;
344
345
}
345
346
if ( ! ( await isPodmanVmSubscriptionActivated ( ) ) ) {
347
+ const facts = {
348
+ supported_architectures : 'aarch64,x86_64' ,
349
+ } ;
350
+ await runCreateFactsFile ( JSON . stringify ( facts , undefined , 2 ) ) ;
346
351
await createOrReuseActivationKey ( ) ;
347
352
}
348
353
}
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ const PODMAN_COMMANDS = {
31
31
SM_DEACTIVATE_SUBS : ( ) => `machine ssh sudo subscription-manager unregister` . split ( ' ' ) ,
32
32
MACHINE_STOP : ( ) => 'machine stop' . split ( ' ' ) ,
33
33
MACHINE_START : ( ) => 'machine start' . split ( ' ' ) ,
34
+ CREATE_FACTS_FILE : ( oneLineJson : string ) => [
35
+ 'machine' ,
36
+ 'ssh' ,
37
+ `sudo mkdir -p /etc/rhsm/facts/ && printf '${ oneLineJson } \\n' | sudo tee /etc/rhsm/facts/podman-desktop-redhat-account-ext.facts` ,
38
+ ] ,
34
39
} ;
35
40
36
41
export function getInstallationPath ( ) : string | undefined {
@@ -132,6 +137,17 @@ export async function runSubscriptionManagerUnregister(): Promise<number | undef
132
137
}
133
138
}
134
139
140
+ export async function runCreateFactsFile ( jsonText : string ) : Promise < number > {
141
+ try {
142
+ await extensionApi . process . exec ( getPodmanCli ( ) , PODMAN_COMMANDS . CREATE_FACTS_FILE ( jsonText . replace ( '\n' , '\\n' ) ) ) ;
143
+ return 0 ;
144
+ } catch ( err ) {
145
+ const exitCode = ( err as extensionApi . RunError ) . exitCode ;
146
+ console . error ( `Writing /etc/rhsm/facts/podman-desktop-redhat-account-ext.facts returned exit code: ${ exitCode } ` ) ;
147
+ return exitCode ;
148
+ }
149
+ }
150
+
135
151
export async function restartPodmanMachine ( ) {
136
152
await extensionApi . process . exec ( getPodmanCli ( ) , PODMAN_COMMANDS . MACHINE_STOP ( ) ) ;
137
153
await extensionApi . process . exec ( getPodmanCli ( ) , PODMAN_COMMANDS . MACHINE_START ( ) ) ;
You can’t perform that action at this time.
0 commit comments