-
Notifications
You must be signed in to change notification settings - Fork 77
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
New module: app_info #259
base: main
Are you sure you want to change the base?
New module: app_info #259
Conversation
7031f07
to
dd1aa23
Compare
@aalaesar package managers in general resolve better if you send the complete list of apps in one command. I know this works for example for apt and pip packages. Not sure if it is the case for occ, but could be worth to try for make it more efficient. Btw @wiktor2200 met me in person today by chance and recognized me xD |
It is not the case the the occ cli tool unfortunately, there are options to get all info at once but it make it less actionable.
|
Signed-off-by: Marc Crebassa <[email protected]>
Signed-off-by: Marc Crebassa <[email protected]>
Signed-off-by: Marc Crebassa <[email protected]>
364052b
to
ab514ab
Compare
Signed-off-by: Marc Crebassa <[email protected]>
Hello there. |
@staticdev @wiktor2200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! @aalaesar sorry for late review.
I've analyzed your code and it looks good.
I'm not convinced only by naming for "shipped" apps, I'd personally rename it to "pre-installed", "default", "enabled_by_default' or similar.
Here in documentation https://docs.nextcloud.com/server/latest/admin_manual/apps_management.html#apps-management they call them: default enabled
or enabled by default
.
But it's up to you, so I leave approve for your code :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry also for taking long and welcome back! From my side the functional side looks good. I found a couple of issues with the imports, some are super minor/cosmetic but anyway they should be on top level.
@@ -0,0 +1,194 @@ | |||
#!/usr/bin/python | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# -*- coding: utf-8 -*- | |
import copy | |
import json | |
from ansible.module_utils.basic import AnsibleModule | |
from ansible_collections.nextcloud.admin.plugins.module_utils.occ import \ | |
run_occ | |
from ansible_collections.nextcloud.admin.plugins.module_utils.occ_args_common import \ | |
OCC_ARGS_SPEC |
Encoding is not necessary to add anymore uft-8 is the default https://stackoverflow.com/questions/14083111/should-i-use-encoding-declaration-in-python-3
Instead I would add all imports here, see explanation below.
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright: (c) 2023, Marc Crébassa <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also avoid adding license to each file since we already have clear license settings on Github and on the repo.
|
||
import copy | ||
import json | ||
from ansible.module_utils.basic import AnsibleModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is normally good to separate build-in imports from 3rd party
import json
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.nextcloud.admin.plugins.module_utils.occ import run_occ | ||
from ansible_collections.nextcloud.admin.plugins.module_utils.occ_args_common import ( | ||
OCC_ARGS_SPEC, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do long imports like this:
from ansible_collections.nextcloud.admin.plugins.module_utils.occ import \
run_occ
from ansible_collections.nextcloud.admin.plugins.module_utils.occ_args_common import \
OCC_ARGS_SPEC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that part was formatted by only-black
returned: success | ||
""" | ||
|
||
import copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imports should come right after #!/usr/bin/python, in this case is not a good idea to declare variables before imports.
Hello there ! 😃 |
Hello There ! 😃 |
Ok, so let's stick to one naming convention or we would to change it everywhere otherwise (we still can in the future). |
Oh my, this documentation really surprises me. Looks like it is stopped in time. In this case, let's keep your solution. If I have some time i will create an issue on Ansible side. |
Add a simple module to get application informations (status, update, etc)
This is intended to be a foundation for the next module for app management