mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
#11558: Introduce GIT_PATH configuration setting
This commit is contained in:
parent
2fc79af4c7
commit
a098c3b0c1
@ -73,6 +73,14 @@ Determines if localization features are enabled or not. This should only be enab
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## GIT_PATH
|
||||||
|
|
||||||
|
Default: `git`
|
||||||
|
|
||||||
|
The system path to the `git` executable, used by the synchronization backend for remote git repositories.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## HTTP_PROXIES
|
## HTTP_PROXIES
|
||||||
|
|
||||||
Default: None
|
Default: None
|
||||||
|
@ -99,7 +99,7 @@ class GitBackend(DataBackend):
|
|||||||
url = self.url
|
url = self.url
|
||||||
|
|
||||||
# Compile git arguments
|
# Compile git arguments
|
||||||
args = ['git', 'clone', '--depth', '1']
|
args = [settings.GIT_PATH, 'clone', '--depth', '1']
|
||||||
if branch := self.params.get('branch'):
|
if branch := self.params.get('branch'):
|
||||||
args.extend(['--branch', branch])
|
args.extend(['--branch', branch])
|
||||||
args.extend([url, local_path.name])
|
args.extend([url, local_path.name])
|
||||||
@ -112,10 +112,13 @@ class GitBackend(DataBackend):
|
|||||||
logger.debug(f"Cloning git repo: {' '.join(args)}")
|
logger.debug(f"Cloning git repo: {' '.join(args)}")
|
||||||
try:
|
try:
|
||||||
subprocess.run(args, check=True, capture_output=True, env=env_vars)
|
subprocess.run(args, check=True, capture_output=True, env=env_vars)
|
||||||
except subprocess.CalledProcessError as e:
|
except FileNotFoundError as e:
|
||||||
raise SyncError(
|
raise SyncError(
|
||||||
f"Fetching remote data failed: {e.stderr}"
|
f"Unable to fetch: git executable not found. Check that the git executable exists at the "
|
||||||
|
f"configured path: {settings.GIT_PATH}"
|
||||||
)
|
)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
raise SyncError(f"Fetching remote data failed: {e.stderr}")
|
||||||
|
|
||||||
yield local_path.name
|
yield local_path.name
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ EMAIL = getattr(configuration, 'EMAIL', {})
|
|||||||
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
||||||
FIELD_CHOICES = getattr(configuration, 'FIELD_CHOICES', {})
|
FIELD_CHOICES = getattr(configuration, 'FIELD_CHOICES', {})
|
||||||
FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(configuration, 'FILE_UPLOAD_MAX_MEMORY_SIZE', 2621440)
|
FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(configuration, 'FILE_UPLOAD_MAX_MEMORY_SIZE', 2621440)
|
||||||
|
GIT_PATH = getattr(configuration, 'GIT_PATH', 'git')
|
||||||
HTTP_PROXIES = getattr(configuration, 'HTTP_PROXIES', None)
|
HTTP_PROXIES = getattr(configuration, 'HTTP_PROXIES', None)
|
||||||
INTERNAL_IPS = getattr(configuration, 'INTERNAL_IPS', ('127.0.0.1', '::1'))
|
INTERNAL_IPS = getattr(configuration, 'INTERNAL_IPS', ('127.0.0.1', '::1'))
|
||||||
JINJA2_FILTERS = getattr(configuration, 'JINJA2_FILTERS', {})
|
JINJA2_FILTERS = getattr(configuration, 'JINJA2_FILTERS', {})
|
||||||
|
Loading…
Reference in New Issue
Block a user