Miloš Selečéni
Miloš Selečéni

Reputation: 23

How to determine the type of OS the service fabric cluster is running on

I'm trying to find out what type of OS(Win or Linux) my Service Fabric cluster is running on once you are connected to it. I need to determine the OS type the SF cluster is running on, so I can modify the ServiceManifest.xml endpoints names of Application endpoints accordingly. On Windows your endpoint needs to have '.exe' but if you deploy your service to a Linux cluster it's without it

Windows

<EntryPoint>
      <ExeHost>
        <Program>MyApp.exe</Program>
      </ExeHost>
</EntryPoint>

Linux

<EntryPoint>
      <ExeHost>
        <Program>MyApp</Program>
      </ExeHost>
</EntryPoint>

I want to have only one ServiceManifest.xml in project and modify it accordingly

I've looked at sfctl and PowerShell CLI utility, but I can't find any info about what OS the clusters are running on.

Any idea how to determine the OS type once you connect to the cluster

Update: I've found that if your cluster is running in Azure cloud you can use

az sf cluster list and there you can find vmImage="Windows" property. But you can't use this on localhost

Upvotes: 2

Views: 402

Answers (1)

LoekD
LoekD

Reputation: 11470

On localhost you can use regular PowerShell Core to find out what OS the script is running on:

[System.Environment]::OSVersion.Platform

Upvotes: 0

Related Questions