Skip to content
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

NAS-130160 / 24.10 / Prevent bug tickets from vendored install #14062

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/freenas/usr/local/bin/truenas-grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import psutil
import os
import json
import logging

from middlewared.utils.serial import serial_port_choices
from middlewared.utils.db import query_config_table
from middlewared.utils.vendor import Vendors

logger = logging.getLogger(__name__)

def get_serial_ports():
return {e['start']: e['name'].replace('uart', 'ttyS') for e in serial_port_choices()}
Expand All @@ -16,12 +19,14 @@ def get_serial_ports():
advanced = query_config_table("system_advanced", prefix="adv_")
kernel_extra_options = advanced.get("kernel_extra_options") or ""

# check for /data/.vendor
vendor = Vendors.TRUENAS_SCALE
try:
with open("/data/.vendor", "r") as f:
vendor = json.loads(f.read()).get("name", "TrueNAS Scale")
vendor = json.loads(f.read()).get("name", Vendors.TRUENAS_SCALE)
yocalebo marked this conversation as resolved.
Show resolved Hide resolved
except FileNotFoundError:
vendor = "TrueNAS Scale"
pass
except Exception:
logger.error("Failed to parse /data/.vendor", exc_info=True)

# We need to allow tpm in grub as sedutil-cli requires it
# `zfsforce=1` is needed because FreeBSD bootloader imports boot pool with hostid=0 while SCALE releases up to
Expand Down
7 changes: 7 additions & 0 deletions src/middlewared/middlewared/plugins/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ async def is_available(self):
Returns whether Proactive Support is available for this product type and current license.
"""

if await self.middleware.call('system.vendor.name'):
return False

if not await self.middleware.call('system.is_enterprise'):
return False

Expand Down Expand Up @@ -224,6 +227,10 @@ async def new_ticket(self, job, data):
For SCALE Enterprise `token` and `type` attributes are not required.
"""

vendor = await self.middleware.call('system.vendor.name')
if vendor:
raise CallError(f'Support is not available for this product ({vendor})', errno.EINVAL)

await self.middleware.call('network.general.will_perform_activity', 'support')

job.set_progress(1, 'Gathering data')
Expand Down
Loading