Merge "Move Helm chart repo refresh from Sysinv conductor to agent"
This commit is contained in:
commit
f280c4a598
|
@ -2009,3 +2009,20 @@ class AgentManager(service.PeriodicService):
|
|||
memory,
|
||||
force_update=True)
|
||||
self._inventory_reported.add(self.MEMORY)
|
||||
|
||||
def refresh_helm_repo_information(self, context):
|
||||
"""Refresh the helm chart repository information.
|
||||
|
||||
:param context: an admin context
|
||||
:return: None
|
||||
"""
|
||||
if self._ihost_personality == constants.CONTROLLER:
|
||||
LOG.debug("AgentManager.refresh_helm_repo_information")
|
||||
with open(os.devnull, "w") as fnull:
|
||||
try:
|
||||
subprocess.check_call(['sudo', '-u', 'sysadmin',
|
||||
'helm', 'repo', 'update'],
|
||||
stdout=fnull, stderr=fnull)
|
||||
except subprocess.CalledProcessError:
|
||||
# Just log an error. Don't stop any callers from further execution.
|
||||
LOG.warn("Failed to update helm repo data for user sysadmin.")
|
||||
|
|
|
@ -301,3 +301,18 @@ class AgentAPI(sysinv.openstack.common.rpc.proxy.RpcProxy):
|
|||
return self.fanout_cast(context,
|
||||
self.make_msg('update_host_memory',
|
||||
host_uuid=host_uuid))
|
||||
|
||||
def refresh_helm_repo_information(self, context):
|
||||
"""Asynchronously, refresh helm chart repository information
|
||||
|
||||
:param context: request context.
|
||||
:returns: none ... uses asynchronous cast().
|
||||
"""
|
||||
# fanout / broadcast message to all inventory agents
|
||||
LOG.debug("AgentApi.refresh_helm_repo_information: fanout_cast: "
|
||||
"sending refresh_helm_repo_information to agent")
|
||||
retval = self.fanout_cast(context,
|
||||
self.make_msg(
|
||||
'refresh_helm_repo_information'))
|
||||
|
||||
return retval
|
||||
|
|
|
@ -102,7 +102,6 @@ from sysinv.puppet import common as puppet_common
|
|||
from sysinv.puppet import puppet
|
||||
from sysinv.helm import common as helm_common
|
||||
from sysinv.helm import helm
|
||||
from sysinv.helm import utils as helm_utils
|
||||
|
||||
MANAGER_TOPIC = 'sysinv.conductor_manager'
|
||||
|
||||
|
@ -225,8 +224,6 @@ class ConductorManager(service.PeriodicService):
|
|||
|
||||
self._handle_restore_in_progress()
|
||||
|
||||
helm_utils.refresh_helm_repo_information()
|
||||
|
||||
LOG.info("sysinv-conductor start committed system=%s" %
|
||||
system.as_dict())
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
import ruamel.yaml as yaml
|
||||
from oslo_log import log as logging
|
||||
import subprocess
|
||||
from sysinv.agent import rpcapi as agent_rpcapi
|
||||
from sysinv.common import exception
|
||||
from sysinv.openstack.common import context
|
||||
import threading
|
||||
import os
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -23,21 +24,15 @@ def refresh_helm_repo_information():
|
|||
"""Refresh the helm chart repository information.
|
||||
|
||||
Ensure that the local repository information maintained in key user home
|
||||
directories are updated. Run this when the conductor is initialized and
|
||||
after application uploads.
|
||||
directories are updated. Run this after application uploads.
|
||||
|
||||
This handles scenarios where an upload occurs on the active controller
|
||||
followed by a swact. The newly actvated controller needs to make sure that
|
||||
the local repository cache reflect any changes.
|
||||
"""
|
||||
with open(os.devnull, "w") as fnull:
|
||||
try:
|
||||
subprocess.check_call(['sudo', '-u', 'sysadmin',
|
||||
'helm', 'repo', 'update'],
|
||||
stdout=fnull, stderr=fnull)
|
||||
except subprocess.CalledProcessError:
|
||||
# Just log an error. Don't stop any callers from further execution.
|
||||
LOG.error("Failed to update helm repo data for user sysadmin.")
|
||||
LOG.debug("refresh_helm_repo_information: sending command to agent(s)")
|
||||
rpcapi = agent_rpcapi.AgentAPI()
|
||||
rpcapi.refresh_helm_repo_information(context.get_admin_context())
|
||||
|
||||
|
||||
def retrieve_helm_releases():
|
||||
|
|
Loading…
Reference in New Issue