mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Removed circular dependency on salt.utils.files.fopen
This commit is contained in:
parent
5910c162d7
commit
56f3cbeff8
1 changed files with 8 additions and 2 deletions
|
@ -12,7 +12,8 @@ import sys
|
||||||
import distro
|
import distro
|
||||||
|
|
||||||
from salt.utils.decorators import memoize as real_memoize
|
from salt.utils.decorators import memoize as real_memoize
|
||||||
from salt.utils.files import fopen as _fopen
|
|
||||||
|
## from salt.utils.files import fopen as _fopen
|
||||||
|
|
||||||
|
|
||||||
def linux_distribution(full_distribution_name=True):
|
def linux_distribution(full_distribution_name=True):
|
||||||
|
@ -246,6 +247,7 @@ def get_machine_identifier():
|
||||||
"""
|
"""
|
||||||
Provide the machine-id for machine/virtualization combination
|
Provide the machine-id for machine/virtualization combination
|
||||||
"""
|
"""
|
||||||
|
# pylint: disable=resource-leakage
|
||||||
# Provides:
|
# Provides:
|
||||||
# machine-id
|
# machine-id
|
||||||
locations = ["/etc/machine-id", "/var/lib/dbus/machine-id"]
|
locations = ["/etc/machine-id", "/var/lib/dbus/machine-id"]
|
||||||
|
@ -253,5 +255,9 @@ def get_machine_identifier():
|
||||||
if not existing_locations:
|
if not existing_locations:
|
||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
with _fopen(existing_locations[0]) as machineid:
|
## with _fopen(existing_locations[0]) as machineid:
|
||||||
|
# cannot use salt.utils.files.fopen due to circular dependency
|
||||||
|
with open(
|
||||||
|
existing_locations[0], encoding=__salt_system_encoding__
|
||||||
|
) as machineid:
|
||||||
return {"machine_id": machineid.read().strip()}
|
return {"machine_id": machineid.read().strip()}
|
||||||
|
|
Loading…
Add table
Reference in a new issue