HeinleinSupport / check_mk_extensions

check_mk Plugins
https://www.heinlein-consulting.de/
GNU General Public License v2.0
230 stars 106 forks source link

Agent bakery crash on checkmk 1.6.0b11 #53

Closed kct-networx closed 4 years ago

kct-networx commented 4 years ago

After creation of the rule to deploy the plugin, the baking of Agents fails:

Exception: Error creating agent for my-server: Error creating agents: Error creating cffd1e1f1bbd5641/linux_rpm agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_deb agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_tgz agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/windows_msi agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 8, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/windows/plugins/apcaccess.bat", plugins_dir + "/apcaccess.bat")
AttributeError: 'module' object has no attribute 'paths'
.
.
Agent baking started...
2019-09-18 12:57:37,811 [40] [cmk.web.automations 22586] Error running 'check_mk --automation bake-agents --' (exit code 2)
2019-09-18 12:57:37,813 [40] [cmk.web.background_process 22586] Exception in background function
Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk/gui/background_job.py", line 205, in _execute_function
    func_ptr(*args, **kwargs)
  File "/omd/sites/mk/lib/python/cmk/gui/cee/plugins/wato/agent_bakery.py", line 5184, in bake_agents_background_job
    watolib.check_mk_local_automation('bake-agents')
  File "/omd/sites/mk/lib/python/cmk/gui/watolib/automations.py", line 126, in check_mk_local_automation
    raise MKGeneralException(_hilite_errors(outdata))
MKGeneralException: Error creating agent for my-server: Error creating agents: Error creating cffd1e1f1bbd5641/linux_rpm agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_deb agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_tgz agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/windows_msi agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 8, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/windows/plugins/apcaccess.bat", plugins_dir + "/apcaccess.bat")
AttributeError: 'module' object has no attribute 'paths'
.
.

Exception: Error creating agent for my-server: Error creating agents: Error creating cffd1e1f1bbd5641/linux_rpm agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_deb agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/linux_tgz agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 6, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/plugins/apcaccess", plugins_dir + "/apcaccess")
AttributeError: 'module' object has no attribute 'paths'
.

Error creating cffd1e1f1bbd5641/windows_msi agent for my-server: Error in bakery plugin "apcaccess": 'module' object has no attribute 'paths'

Traceback (most recent call last):
  File "/omd/sites/mk/lib/python/cmk_base/cee/agent_bakery.py", line 364, in execute_bakery_plugin
    bake_func(*func_args)
  File "/omd/sites/mk/local/share/check_mk/agents/bakery/apcaccess", line 8, in bake_apcaccess
    shutil.copy2(cmk.paths.local_agents_dir + "/windows/plugins/apcaccess.bat", plugins_dir + "/apcaccess.bat")
AttributeError: 'module' object has no attribute 'paths'
.
.
jiuka commented 4 years ago

By changing cmk.paths.local_agents_dir to cmk.utils.paths.local_agents_dir i could get it to work.

@@ -3,7 +3,7 @@

 def bake_sslcertificates(opsys, conf, conf_dir, plugins_dir):
     if opsys == "linux":
-        shutil.copy2(cmk.paths.local_agents_dir + "/plugins/sslcertificates", plugins_dir + "/sslcertificates")
+        shutil.copy2(cmk.utils.paths.local_agents_dir + "/plugins/sslcertificates", plugins_dir + "/sslcertificates")
         f = file(conf_dir + "/sslcertificates", "w")
         f.write(agent_file_header)

@@ -17,7 +17,7 @@
         if dirs:
             f.write("CERT_DIRS=\"%s\"\n" % " ".join(dirs))
     elif opsys == "windows":
-        shutil.copy2(cmk.paths.local_agents_dir + "/windows/plugins/sslcertificates.ps1", plugins_dir + "/sslcertificates.ps1")
+        shutil.copy2(cmk.utils.paths.local_agents_dir + "/windows/plugins/sslcertificates.ps1", plugins_dir + "/sslcertificates.ps1")

 bakery_info["sslcertificates"] = {
     "bake_function" : bake_sslcertificates,
kct-networx commented 4 years ago

You are right. Works here as well with the changes above. Do you know if this is just a 1.6 issue? And what happens to 1.5 bakery if the above change is implemented?

gurubert commented 4 years ago

Please use the cmk1.6 branch