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

Add arrays support for xfconf module #46308

Closed
nicovell3 opened this issue Sep 29, 2018 · 10 comments · Fixed by ansible-collections/community.general#693
Closed

Add arrays support for xfconf module #46308

nicovell3 opened this issue Sep 29, 2018 · 10 comments · Fixed by ansible-collections/community.general#693
Labels
affects_2.8 This issue/PR affects Ansible v2.8 collection:community.general collection Related to Ansible Collections work feature This issue/PR relates to a feature request. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category

Comments

@nicovell3
Copy link

SUMMARY

Add arrays support for the xfconf module.

ISSUE TYPE
  • xfconf-query command can set up arrays. I needed that feature to automatize my xfce4 panels creation, so I implemented it. I would like someone to add to this repo the modifications I made to the xfconf.py file.
COMPONENT NAME

xfconf

ADDITIONAL INFORMATION

With this modification, array values can be queried and set. Also, if someone wants to create a value and force it to be an array, it just requires to add the "force_array: yes" to the playbook.

Here comes an usage example:

  - name: Configure xfconf arrays
    become_user: '{{ user }}'
    environment:
      DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ uid }}/bus"
    xfconf:
      channel: "{{ item.channel }}"
      property: "{{ item.property }}"
      value_type: "{{ item.type }}"
      value: "{{ item.value }}"
      force_array: yes
      state: present
    with_items:
      - { channel: 'xfce4-panel', property: '/panels', type: 'int', value: '1' }
      - { channel: 'xfce4-panel', property: '/panels/panel-1/plugin-ids', type: 'int,int,int,int,int,int', value: '1,2,3,4,5,6' }

The modified xfconf.py can be found here: https://gist.github.com/nicovell3/a32f3a144d037ed018ebccd8a94e979d

I've tested some playbooks (get information and so on) and everything is working as it should.

@ansibot
Copy link
Contributor

ansibot commented Sep 29, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 29, 2018
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 1, 2018
@ansibot ansibot added the needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) label Oct 9, 2018
@ansibot ansibot removed the needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) label Nov 10, 2018
@ansibot
Copy link
Contributor

ansibot commented Dec 12, 2018

@jbenden
Copy link
Contributor

jbenden commented Dec 12, 2018

Please submit a Pull Request with your change. Thanks!

@nicovell3
Copy link
Author

@jbenden I'm not familiar with the Pull Request mechanism, so I prefer not to do it myself for this little modification.

@jbenden
Copy link
Contributor

jbenden commented Dec 18, 2018

I've created a PR for you. Thanks for your contributions!

@ansibot
Copy link
Contributor

ansibot commented Feb 12, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot removed the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Feb 12, 2019
@particledecay
Copy link

particledecay commented Feb 14, 2019

I believe this breaks expected behavior, such as when strings naturally contain commas:

- name: Set titlebar button layout
  xfconf:
    channel: xsettings
    property: /Gtk/DecorationLayout
    value_type: "string"
    value: "close,maximize,minimize,menu:"

However, since value=dict(required=False, type='list'), this will be interpreted as a list instead of as a string. The above example will produce the following failure:

FAILED! => {"changed": false, "msg": "Same number of \"value\" and \"value_type\" needed"}

@ansibot ansibot added the system System category label Feb 22, 2019
@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 24, 2019
@Andersson007
Copy link
Contributor

close_me

@Andersson007
Copy link
Contributor

@mkrizek
Copy link
Contributor

mkrizek commented Aug 18, 2020

Closing per above.

@mkrizek mkrizek closed this as completed Aug 18, 2020
@ansible ansible locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 collection:community.general collection Related to Ansible Collections work feature This issue/PR relates to a feature request. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
7 participants