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

Issue with global_properties when properties contain a dash "-" #729

Open
morgan-patou opened this issue Dec 6, 2023 · 4 comments
Open
Labels
bug Something isn't working as expected

Comments

@morgan-patou
Copy link
Contributor

morgan-patou commented Dec 6, 2023

Bug description

I was playing/testing the global_properties definition but while doing so, it appears that Alfresco properties that are set like that fails to be setup properly in the alfresco-global.properties file when said property contains a dash (-).

Here is the example of global_properties that I tried:

global_properties:
  ...
  system:
    serverMode: "PRODUCTION"
    thumbnail:
      generate: "true"
    usages:
      enabled: "false"
      clearBatchSize: "0"
    workflow:
      engine:
        activiti:
          enabled: "true"
          definitions:
            visible: "true"
  audit:
    enabled: "false"
    cmischangelog:
      enabled: "false"
    sync:
      enabled: "false"
    tagging:
      enabled: "false"
    alfresco-access:
      enabled: "false"
      sub-actions:
        enabled: "false"
  heartbeat:
    enabled: "false"
  sample:
    site:
      disabled: "true"

And the generated alfresco-global.properties:

alfresco@mop-alf-ce:/etc/opt/alfresco/content-services/classpath$ cat alfresco-global.properties
...
system.serverMode=PRODUCTION
system.thumbnail.generate=true
system.usages.enabled=false
system.usages.clearBatchSize=0
system.workflow.engine.activiti.enabled=true
system.workflow.engine.activiti.definitions.visible=true
audit.enabled=false
audit.cmischangelog.enabled=false
audit.sync.enabled=false
audit.tagging.enabled=false
audit['alfresco-access'].enabled=false
audit['alfresco-access']['sub-actions'].enabled=false
heartbeat.enabled=false
sample.site.disabled=true

index.subsystem.name=solr6
...

As you can see above, all properties appears to be set properly except for the 2 lines with alfresco-access or sub-actions.

Ansible error

No errors at Ansible level:

Wednesday 06 December 2023  12:31:52 +0000 (0:00:00.069)       0:04:03.187 ****
 [started TASK: ../roles/repository : Create alfresco-global.properties main snippet on oci/mop-alf-ce]

TASK [../roles/repository : Create alfresco-global.properties main snippet] **************************************************************************************************************************************************
changed: [oci/mop-alf-ce]
Wednesday 06 December 2023  12:31:54 +0000 (0:00:02.036)       0:04:05.224 ****
 [started TASK: ../roles/repository : Check raw snippet can be parsed on oci/mop-alf-ce]

TASK [../roles/repository : Check raw snippet can be parsed] *****************************************************************************************************************************************************************
ok: [oci/mop-alf-ce] => (item=../../configuration_files/alfresco-global.properties) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": "../../configuration_files/alfresco-global.properties",
    "msg": "All assertions passed"
}
Wednesday 06 December 2023  12:31:54 +0000 (0:00:00.094)       0:04:05.318 ****
 [started TASK: ../roles/repository : Add snippet from custom config files ../../configuration_files/alfresco-global.properties on oci/mop-alf-ce]

TASK [../roles/repository : Add snippet from custom config files ../../configuration_files/alfresco-global.properties] *******************************************************************************************************
changed: [oci/mop-alf-ce] => (item=../../configuration_files/alfresco-global.properties)
Wednesday 06 December 2023  12:31:55 +0000 (0:00:01.055)       0:04:06.374 ****
 [started TASK: ../roles/repository : Assemble alfresco-global.properties snippets on oci/mop-alf-ce]

TASK [../roles/repository : Assemble alfresco-global.properties snippets] ****************************************************************************************************************************************************
changed: [oci/mop-alf-ce]
@gionn
Copy link
Member

gionn commented Dec 6, 2023

it's something we also faced recently while working on an internal project, can't find now a specific reference but you can try a workaround defining those as:

audit:
  alfresco-access.enabled: false
  alfresco-access.sub-actions.enabled: false

@gionn gionn added the bug Something isn't working as expected label Dec 6, 2023
@morgan-patou
Copy link
Contributor Author

@gionn : Maybe I'm missing something but when I tried with your suggestion, I had the exact same behavior as before.

Definition of the global_properties:

global_properties:
    ...
  aos:
    baseUrlOverwrite: >-
      {{ acs_play_proto }}://{{ fqdn_alfresco | default(nginx_host) }}:{{ acs_play_port }}/alfresco/aos
  audit:
    enabled: "false"
    cmischangelog:
      enabled: "false"
    sync:
      enabled: "false"
    tagging:
      enabled: "false"
    alfresco-access.enabled: "false"
    alfresco-access.sub-actions.enabled: "false"
  heartbeat:
    enabled: "false"

That generated the following content on the newly installed server:

aos.baseUrlOverwrite=https://mydns.com:443/alfresco/aos
audit.enabled=false
audit.cmischangelog.enabled=false
audit.sync.enabled=false
audit.tagging.enabled=false
audit['alfresco-access.enabled']=false
audit['alfresco-access.sub-actions.enabled']=false
heartbeat.enabled=false

Therefore, whether I use

global_properties:
  audit:
    alfresco-access:
      enabled: "false"
      sub-actions:
        enabled: "false"

or

global_properties:
  audit:
    alfresco-access.enabled: "false"
    alfresco-access.sub-actions.enabled: "false"

I have the same outcome. Well it is not 100% the same file audit['alfresco-access'].enabled=false (before) vs audit['alfresco-access.enabled']=false (after) but it's the same behavior and the issue is still present.

I will do 1 more try with the following to see if the behavior changes:

global_properties:
  audit.alfresco-access.enabled: "false"
  audit.alfresco-access.sub-actions.enabled: "false"

@morgan-patou
Copy link
Contributor Author

So I can confirm that the workaround requires the 1st word of the line to not contain any "-". Therefore, the following works properly:

global_properties:
  audit:
    enabled: "false"
    cmischangelog:
      enabled: "false"
    sync:
      enabled: "false"
    tagging:
      enabled: "false"
  audit.alfresco-access.enabled: "false"
  audit.alfresco-access.sub-actions.enabled: "false"
  heartbeat:
    enabled: "false"

Generated the correct content in the alfresco-global.properties:

audit.enabled=false
audit.cmischangelog.enabled=false
audit.sync.enabled=false
audit.tagging.enabled=false
audit.alfresco-access.enabled=false
audit.alfresco-access.sub-actions.enabled=false
heartbeat.enabled=false

@gionn
Copy link
Member

gionn commented Feb 22, 2024

Thanks for taking time to sort it out.

The bug actually is within the usage of ansible.utils.to_paths to convert the complex object of global_properties to a plain properties file:

{% for prop in lookup('ansible.utils.to_paths', merged_repository_properties) | dict2items %}

could be a bug in ansible as well, but we never had time to investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants