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

'occ app:enable appname' should make it clear that an app was already enabled #17789

Closed
nodiscc opened this issue Nov 3, 2019 · 2 comments · Fixed by #19514
Closed

'occ app:enable appname' should make it clear that an app was already enabled #17789

nodiscc opened this issue Nov 3, 2019 · 2 comments · Fixed by #19514
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: apps management good first issue Small tasks with clear documentation about how and in which place you need to fix things in.

Comments

@nodiscc
Copy link

nodiscc commented Nov 3, 2019

Steps to reproduce

  1. Enable an already enabled app through php ./occ app:enable appname

Expected behaviour

The command should succeed (return code 0) and return appname already enabled on the standard output.

Actual behaviour

The command succeeds but returns appname enabled, exactly the same message as when the app was not previously enabled. This makes it difficult to determine if the command actually changed something and prevents using occ in an idempotent way in configuration management tools (ansible).

In this regard app:disable appname works as expected as it returns No such app enabled: appname when the app was already disabled. This makes it possible to detect that nothing was changed.

Server configuration

Operating system: Debian GNU/Linux 10 Buster

Web server: Apache 2.4

Database: MySQL

PHP version: 7.3

Nextcloud version: 17.0

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

Where did you install Nextcloud from: tarball at https://download.nextcloud.com/server/releases/nextcloud-17.0.0.zip

@nodiscc nodiscc added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Nov 3, 2019
@kesselb
Copy link
Contributor

kesselb commented Nov 3, 2019

Index: core/Command/App/Enable.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/Command/App/Enable.php	(revision 78d00ff0852a6199cc7ca33db6308f7bdd09b5a6)
+++ core/Command/App/Enable.php	(date 1572793732067)
@@ -98,6 +98,10 @@
 			return $group->getDisplayName();
 		}, $groupIds);
 
+		if ($this->appManager->isInstalled($appId)) {
+			$output->writeln($appId . ' already enabled');
+			return;
+		}
 
 		try {
 			/** @var Installer $installer */

Sounds good to me. Something like above should do the trick. If someone wants to pick this up please also adjust the test: https://github.com/nextcloud/server/blob/5b4155bd12764d0ee0f0380d49b66aa9ea2c7516/tests/Core/Command/Apps/AppsEnableTest.php

@kesselb kesselb added 1. to develop Accepted and waiting to be taken care of enhancement feature: apps management good first issue Small tasks with clear documentation about how and in which place you need to fix things in. and removed bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Nov 3, 2019
@sndrr
Copy link
Contributor

sndrr commented Feb 17, 2020

I've added a PR. It also checks for group parameters, since that setting will impact the output.

nodiscc added a commit to nodiscc/xsrv that referenced this issue Jul 5, 2020
 - determine appropriate setup procedure depending on whether nextcloud is already installed or not, installed version and current role version
 - use ansible local fact file to store nextcloud installed version
 - use temporary extraction directory and replace the old copy with the new one instead of unpacking directly into the documentroot
 - installation is now idempotent
 - ensure correct/restrictive permissions are set
 - nextcloud: move apache configuration steps to separate file, add automatic virtualhost configuration for nextcloud, group previous CSP settings in vhost configuration file
 - reorder setup procedure (setup apache last)
 - enable additional php modules https://docs.nextcloud.com/server/16/admin_manual/installation/source_installation.html#apache-web-server-configuration
 - Note: 'become' is not a valid attribute for a TaskInclude, use include - https://docs.ansible.com/ansible/latest/modules/include_module.html
 - reload apache instead of restarting when possible
 - fix Module did not set no_log for update_password (mysql_user)
 - update documentation, add screenshots
 - use ansible-vault to manage secret variables by default
 - templatize nextcloud domain name/install directory/full URL
 - make app enable/disable task idempotent - nextcloud/server#19514, nextcloud/server#17789
 - require manual configuration of nextcloud FQDN
 - update calendar app to 2.0.2
 - https://docs.nextcloud.com/server/16/admin_manual/maintenance/manual_upgrade.html
nodiscc added a commit to nodiscc/xsrv that referenced this issue Jul 14, 2020
 - determine appropriate setup procedure depending on whether nextcloud is already installed or not, installed version and current role version
 - use ansible local fact file to store nextcloud installed version
 - use temporary extraction directory and replace the old copy with the new one instead of unpacking directly into the documentroot
 - installation is now idempotent
 - ensure correct/restrictive permissions are set
 - nextcloud: move apache configuration steps to separate file, add automatic virtualhost configuration for nextcloud, group previous CSP settings in vhost configuration file
 - reorder setup procedure (setup apache last)
 - enable additional php modules https://docs.nextcloud.com/server/16/admin_manual/installation/source_installation.html#apache-web-server-configuration
 - Note: 'become' is not a valid attribute for a TaskInclude, use include - https://docs.ansible.com/ansible/latest/modules/include_module.html
 - reload apache instead of restarting when possible
 - fix Module did not set no_log for update_password (mysql_user)
 - update documentation, add screenshots
 - use ansible-vault to manage secret variables by default
 - templatize nextcloud domain name/install directory/full URL
 - make app enable/disable task idempotent - nextcloud/server#19514, nextcloud/server#17789
 - require manual configuration of nextcloud FQDN
 - update calendar app to 2.0.2
 - https://docs.nextcloud.com/server/16/admin_manual/maintenance/manual_upgrade.html
nodiscc added a commit to nodiscc/xsrv that referenced this issue Jul 14, 2020
 - determine appropriate setup procedure depending on whether nextcloud is already installed or not, installed version and current role version
 - use ansible local fact file to store nextcloud installed version
 - use temporary extraction directory and replace the old copy with the new one instead of unpacking directly into the documentroot
 - installation is now idempotent
 - ensure correct/restrictive permissions are set
 - nextcloud: move apache configuration steps to separate file, add automatic virtualhost configuration for nextcloud, group previous CSP settings in vhost configuration file
 - reorder setup procedure (setup apache last)
 - enable additional php modules https://docs.nextcloud.com/server/16/admin_manual/installation/source_installation.html#apache-web-server-configuration
 - Note: 'become' is not a valid attribute for a TaskInclude, use include - https://docs.ansible.com/ansible/latest/modules/include_module.html
 - reload apache instead of restarting when possible
 - fix Module did not set no_log for update_password (mysql_user)
 - update documentation, add screenshots
 - use ansible-vault to manage secret variables by default
 - templatize nextcloud domain name/install directory/full URL
 - make app enable/disable task idempotent - nextcloud/server#19514, nextcloud/server#17789
 - require manual configuration of nextcloud FQDN
 - update calendar app to 2.0.2
 - https://docs.nextcloud.com/server/16/admin_manual/maintenance/manual_upgrade.html
nodiscc added a commit to nodiscc/xsrv that referenced this issue Jul 14, 2020
 - determine appropriate setup procedure depending on whether nextcloud is already installed or not, installed version and current role version
 - use ansible local fact file to store nextcloud installed version
 - use temporary extraction directory and replace the old copy with the new one instead of unpacking directly into the documentroot
 - installation is now idempotent
 - ensure correct/restrictive permissions are set
 - nextcloud: move apache configuration steps to separate file, add automatic virtualhost configuration for nextcloud, group previous CSP settings in vhost configuration file
 - reorder setup procedure (setup apache last)
 - enable additional php modules https://docs.nextcloud.com/server/16/admin_manual/installation/source_installation.html#apache-web-server-configuration
 - Note: 'become' is not a valid attribute for a TaskInclude, use include - https://docs.ansible.com/ansible/latest/modules/include_module.html
 - reload apache instead of restarting when possible
 - fix Module did not set no_log for update_password (mysql_user)
 - update documentation, add screenshots
 - use ansible-vault to manage secret variables by default
 - templatize nextcloud domain name/install directory/full URL
 - make app enable/disable task idempotent - nextcloud/server#19514, nextcloud/server#17789
 - require manual configuration of nextcloud FQDN
 - update calendar app to 2.0.2
 - https://docs.nextcloud.com/server/16/admin_manual/maintenance/manual_upgrade.html
 - update doc
 - add php-mysql requirement
 - update role metadata, depends on lamp role
 - upgrade nextcloud to 19.0.0, upgrade all nextcloud apps
 - add fine-grained ansible tags
 - upgrade: copy config.php from the old installation to the new, fix permissions
 - apache: integration Unset system-wide Content-Security-Policy header since Nextcloud provides its own CSP
 - add nextcloud_https_mode config variable (selfsigned/letsencrypt/none)
 - add tasks to generate self-signed certificates
 - automatically install applications using occ app:install command, remove app-related variables and ansible tasks
 - upgrade all applications during setup
 - enable APCu memcache https://docs.nextcloud.com/server/19/admin_manual/configuration_server/caching_configuration.html
 - gallery app replaced with photos app
 - update doc
 - fix upgrade mechanism/only copy old config.pho when nextcloud_action == 'upgrade'
 - remove old installation directory at the end of upgrades

note on upgrades: 'Exception: Updates between multiple major versions and downgrades are unsupported.'
note on config.php file ownership/permissions: occ has to be executed with the user that owns the file config/config.php either www-data must OWN config.php (rw group access is not enough), or we have to run occ as root - the first option is probably closer to least-privilege principle
note on data directory permissions: Your data directory is readable by other users Please change the permissions to 0770 so that the directory cannot be listed by other users. An unhandled exception has been thrown: Exception: Environment not properly prepared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: apps management good first issue Small tasks with clear documentation about how and in which place you need to fix things in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants