Skip to content

Commit

Permalink
Merge pull request #16 from vst/vst/various-fixes
Browse files Browse the repository at this point in the history
Various Fixes
  • Loading branch information
vst authored Mar 22, 2024
2 parents 1e23511 + 5574d8a commit 7b10a9e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.md
dist-newstyle/
dist/
nix/
*.md
website/
2 changes: 1 addition & 1 deletion src/Lhp/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ instance ADC.HasCodec Distribution where
<*> ADC.requiredField "version" "Distribution version (cat /etc/os-release | grep 'VERSION=')." ADC..= _distributionVersion
<*> ADC.requiredField "release" "Distribution release (cat /etc/os-release | grep 'VERSION_ID=')." ADC..= _distributionRelease
<*> ADC.requiredField "codename" "Distribution codename (cat /etc/os-release | grep 'VERSION_CODENAME=')." ADC..= _distributionCodename
<*> ADC.requiredField "Description" "Distribution description (cat /etc/os-release | grep 'PRETTY_NAME=')." ADC..= _distributionDescription
<*> ADC.requiredField "description" "Distribution description (cat /etc/os-release | grep 'PRETTY_NAME=')." ADC..= _distributionDescription


-- * Docker Container Information
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _check_command curl
# PROCEDURE #
#############

if curl --silent --fail --max-time 3 http://169.254.169.254/latest/meta-data/ami-id >/dev/null; then
if curl --silent --fail --max-time 2 http://169.254.169.254/latest/dynamic/instance-identity/document >/dev/null; then
_print_var "LHP_CLOUD_NAME" "AWS"
_print_var "LHP_CLOUD_ID" "$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
_print_var "LHP_CLOUD_TYPE" "$(curl -s http://169.254.169.254/latest/meta-data/instance-type)"
Expand All @@ -46,14 +46,14 @@ if curl --silent --fail --max-time 3 http://169.254.169.254/latest/meta-data/ami
_print_var "LHP_CLOUD_LOCAL_ADDRESS" "$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)"
_print_var "LHP_CLOUD_PUBLIC_HOSTNAME" "$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)"
_print_var "LHP_CLOUD_PUBLIC_ADDRESS" "$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)"
elif curl --silent --fail --max-time 3 http://169.254.169.254/metadata/v1/ >/dev/null; then
elif curl --silent --fail --max-time 2 http://169.254.169.254/metadata/v1/ >/dev/null; then
_print_var "LHP_CLOUD_NAME" "DO"
_print_var "LHP_CLOUD_ID" "$(curl -s http://169.254.169.254/metadata/v1/id)"
_print_var "LHP_CLOUD_REGION" "$(curl -s http://169.254.169.254/metadata/v1/region)"
_print_var "LHP_CLOUD_LOCAL_ADDRESS" "$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address)"
_print_var "LHP_CLOUD_PUBLIC_ADDRESS" "$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)"
_print_var "LHP_CLOUD_RESERVED_ADDRESS" "$(curl -s http://169.254.169.254/metadata/v1/reserved_ip/ipv4/ip_address)"
elif curl --silent --fail --max-time 3 http://169.254.169.254/latest/meta-data/network-config >/dev/null; then
elif curl --silent --fail --max-time 2 http://169.254.169.254/latest/meta-data/network-config >/dev/null; then
_print_var "LHP_CLOUD_NAME" "HETZNER"
_print_var "LHP_CLOUD_ID" "$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
_print_var "LHP_CLOUD_REGION" "$(curl -s http://169.254.169.254/latest/meta-data/region)"
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/app/-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export function TabulateHosts({ hosts, onHostSelect }: { hosts: LhpData[]; onHos
</div>
</TableCell>
<TableCell>{host.kernel.machine}</TableCell>
<TableCell>{host.distribution.Description}</TableCell>
<TableCell>{host.distribution.description}</TableCell>
<TableCell>{host.cloud.name}</TableCell>
<TableCell>{host.hardware.cpuCount}</TableCell>
<TableCell>{host.hardware.ramTotal}</TableCell>
Expand Down Expand Up @@ -178,7 +178,7 @@ export function HostDetails({ host }: { host: LhpData }) {
{ key: 'Distribution Version ID', value: host.distribution.id },
{ key: 'Distribution Version', value: host.distribution.version },
{ key: 'Distribution Version Code', value: host.distribution.codename },
{ key: 'Distribution Full Name', value: host.distribution.Description },
{ key: 'Distribution Full Name', value: host.distribution.description },
{ key: 'Cloud', value: host.cloud.name },
{ key: 'Type', value: host.cloud.hostType },
{ key: 'Region', value: host.cloud.hostRegion },
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/app/-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface LhpData {
[k: string]: unknown;
};
distribution: {
Description: string;
description: string;
codename: null | string;
id: string;
name: string;
Expand Down

0 comments on commit 7b10a9e

Please sign in to comment.