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

(t) legacy binary path in some scripts #2470

Closed
8 tasks done
FroggyFlox opened this issue Jan 18, 2023 · 10 comments
Closed
8 tasks done

(t) legacy binary path in some scripts #2470

FroggyFlox opened this issue Jan 18, 2023 · 10 comments
Assignees

Comments

@FroggyFlox
Copy link
Member

FroggyFlox commented Jan 18, 2023

On an RPM-installed Rockstor 4.5.4-0, we see the following error when trying to run the debug-mode script:

$ poetry run debug-mode ON
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/rockstor/src/rockstor/scripts/debugmode.py", line 64, in main
    run_command([SUPERCTL_BIN, "restart", "gunicorn"])
  File "/opt/rockstor/src/rockstor/system/osi.py", line 217, in run_command
    raise Exception("Exception while running command({}): {}".format(cmd, e))
Exception: Exception while running command(['/opt/rockstor/bin/supervisorctl', 'restart', 'gunicorn']): [Errno 2] No such file or directory

This is due to the following now-erroneous path defined:

SUPERCTL_BIN = path.join(settings.ROOT_DIR, "bin/supervisorctl")

This should be using our poetry venv instead.
[phillxnet: EDIT] instances found to date summarised:

@phillxnet phillxnet added this to the First Stable Poetry build milestone Jan 18, 2023
@FroggyFlox
Copy link
Member Author

Another instance:

docker_wrapper = "{}bin/docker-wrapper".format(settings.ROOT_DIR)

This is legacy code now, though, and should not be affected by the Poetry move.

@FroggyFlox
Copy link
Member Author

% (replica.crontab, settings.ROOT_DIR, replica.id)

This one should be corrected

@FroggyFlox
Copy link
Member Author

tab = "%s %sbin/st-snapshot %d" % (

tab = "%s %s/bin/st-pool-scrub %d" % (

tab = "%s %s/bin/st-system-power %d" % (

... should be corrected.

@FroggyFlox
Copy link
Member Author

"{}bin/delete-api-key command. If you do delete it, "

... should be corrected.

@FroggyFlox
Copy link
Member Author

... should be corrected.

@FroggyFlox FroggyFlox self-assigned this Jan 18, 2023
FroggyFlox added a commit to FroggyFlox/rockstor-core that referenced this issue Jan 18, 2023
@phillxnet phillxnet changed the title (t) hard-coded path to binary in some script(s) (t) legacy binary path in some scripts Jan 19, 2023
@phillxnet phillxnet self-assigned this Jan 19, 2023
@phillxnet
Copy link
Member

All @FroggyFlox found legacy bin paths have now been addressed in my working branch against this issue.
Just having a quick look for stragglers.

@phillxnet
Copy link
Member

phillxnet commented Jan 19, 2023

We also have the following comments on running subsets of our tests:

Extracted form "

src/rockstor/fs/tests/test_btrfs.py: ./bin/test --settings=test-settings -v 3 -p test_btrfs*
...
src/rockstor/system/tests/test_osi.py: ./bin/test --settings=test-settings -v 3 -p test_osi*
src/rockstor/system/tests/test_pkg_mgmt.py: ./bin/test --settings=test-settings -v 3 -p test_pkg_mgmt*
src/rockstor/system/tests/test_pkg_mgmt.py: # '/usr/bin/zypper', '--non-interactive', '-q', 'list-updates']
src/rockstor/system/tests/test_directory_services.py: ./bin/test --settings=test-settings -v 3 -p test_directory_services*
src/rockstor/system/tests/test_directory_services.py: cmd=["/usr/bin/net", "ads", "workgroup", "-S", domain],
src/rockstor/system/tests/test_system_network.py: ./bin/test --settings=test-settings -v 3 -p test_system_network*
...

src/rockstor/storageadmin/tests/test_appliances.py: # bin/django dumpdata storageadmin.appliance --natural-foreign --indent 4 >
src/rockstor/storageadmin/tests/test_appliances.py: # ./bin/test -v 2 -p test_appliances.py
src/rockstor/storageadmin/tests/test_disk_smart.py: # bin/django dumpdata storageadmin.disk storageadmin.smartcapability
src/rockstor/storageadmin/tests/test_disk_smart.py: # ./bin/test -v 2 -p test_disk_smart.py
src/rockstor/storageadmin/tests/test_disks.py: "Error running a command. cmd = /sbin/btrfs fi show "
src/rockstor/storageadmin/tests/test_pool_balance.py:bin/django dumpdata storageadmin.pool storageadmin.disk storageadmin.poolbalance
src/rockstor/storageadmin/tests/test_pool_balance.py:./bin/test -v 2 -p test_pool_balance.py
src/rockstor/storageadmin/tests/test_pool_balance_huey.py:bin/django dumpdata storageadmin.pool storageadmin.disk storageadmin.poolbalance
src/rockstor/storageadmin/tests/test_pool_balance_huey.py:./bin/test -v 2 -p test_pool_balance.py
src/rockstor/storageadmin/tests/test_pool_scrub.py:bin/django dumpdata storageadmin.pool --natural-foreign --indent 4 >
src/rockstor/storageadmin/tests/test_pool_scrub.py:./bin/test -v 2 -p test_pool_scrub.py
src/rockstor/storageadmin/tests/test_pools.py:bin/django dumpdata storageadmin.pool storageadmin.disk storageadmin.share
src/rockstor/storageadmin/tests/test_pools.py:./bin/test -v 2 -p test_pools.py
src/rockstor/storageadmin/tests/test_samba.py: # bin/django dumpdata storageadmin.pool storageadmin.share
src/rockstor/storageadmin/tests/test_samba.py: # ./bin/test -v 2 -p test_samba.py
src/rockstor/storageadmin/tests/test_shares.py:bin/django dumpdata storageadmin.pool storageadmin.share storageadmin.snapshot
src/rockstor/storageadmin/tests/test_shares.py:bin/django dumpdata --database smart_manager smart_manager.service
src/rockstor/storageadmin/tests/test_shares.py:./bin/test -v 2 -p test_shares.py
src/rockstor/storageadmin/tests/test_snapshot.py:bin/django dumpdata storageadmin.pool storageadmin.share storageadmin.snapshot
src/rockstor/storageadmin/tests/test_snapshot.py:./bin/test -v 2 -p test_snapshot.py
src/rockstor/storageadmin/tests/test_api.py: # bin/django dumpdata --natural-foreign --indent 4 auth.user > src/rockstor/storageadmin/fixtures/test_api.json
src/rockstor/storageadmin/tests/test_user.py: # 'shell': '/bin/xyz', 'email': '[email protected]'}
src/rockstor/storageadmin/tests/test_network.py: # ./bin/test -v 2 -p test_network.py
..

src/rockstor/smart_manager/tests/test_task_scheduler.py: # bin/django dumpdata auth.user storageadmin.pool storageadmin.share
src/rockstor/smart_manager/tests/test_task_scheduler.py: # ./bin/test -v 2 -p test_task_scheduler.py
..

We have also a shell definition here:

src/rockstor/settings.py:VALID_SHELLS = ('{}/bin/rcli'.format(BASE_DIR), '/bin/bash', '/sbin/nologin',)
but from:

# Legacy scripts
# rcli = 'cli.rock_cli:main'
# docker-wrapper = 'scripts.docker_wrapper:main'
# rockon-json = 'scripts.rockon_util:main'

'rcli' is one of our currently legacy entry-points.

This file is thought to be redundant but should be removed under it's own issue to prove this claim.

etc/init.d/gunicorn:DAEMON=/opt/rockstor/bin/gunicorn

@phillxnet
Copy link
Member

A follow up issue has now been created and linked back to this one concerning the many comment changes required within our test. As these also require other modifications given we no longer maintain a test-settings.py

@phillxnet
Copy link
Member

phillxnet commented Jan 19, 2023

I have included, by way of establishing an in-code reference for the future, a fix for the following single test subset instructional comment:

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jan 19, 2023
Replace all currently identified, previously missed,
live legacy binary paths. Thanks to FroggyFlox on GitHub
for greatly assisting with these changes.
Affects:
- debugmode selection script
- docker wrapper functions
- replication
- task scheduling
## Includes
- an example of a change required to our various test comments
concerning a similar change required that will be addressed
in a follow-up patch (test_btrfs.py)
- user facing text changes pertaining to related path changes:
(login.html, oauth_app.py)
phillxnet added a commit that referenced this issue Jan 19, 2023
…n_some_scripts

(t) legacy binary path in some scripts/functions #2470
@phillxnet
Copy link
Member

Closing as:
Fixed by #2476

Thanks again to @FroggyFlox for much of the ground work on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants