datastax / cstar_perf

Apache Cassandra performance testing platform
Apache License 2.0
72 stars 34 forks source link

Remove sudo usage #180

Closed mshuler closed 7 years ago

mshuler commented 8 years ago

I'm working on moving cstar_perf to run as a minimally privileged user and found several uses of sudo, mostly for filesystem manipulation. As long as file system ownership is correct, these really should be unnecessary.

$ git grep sudo
frontend/README.md:    sudo apt-get install python2.7 python2.7-dev python-virtualenv libtool cassandra
tool/cstar_perf/docker/cstar_docker.py:RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections && \
tool/cstar_perf/docker/cstar_docker.py:RUN echo "%wheel        ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers && \
tool/cstar_perf/tool/benchmark.py:        execute(fab.sudo, 'rm -rf /var/lib/spark')
tool/cstar_perf/tool/benchmark.py:        execute(fab.sudo, 'mkdir -p /var/lib/spark')
tool/cstar_perf/tool/benchmark.py:        execute(fab.sudo, 'chmod -R 777 /var/lib/spark')
tool/cstar_perf/tool/fab_flamegraph.py:    fab.run('sudo chmod o+r {}'.format(os.path.join(flamegraph_directory, '*')))
tool/cstar_perf/tool/fab_flamegraph.py:    fab.run('sudo perf script -i {} > {}'.format(perf_data_file, stacks_file))
tool/cstar_perf/tool/fab_flamegraph.py:    fab.run('sudo chmod o+r {}'.format(os.path.join(flamegraph_directory, '*')))
tool/cstar_perf/tool/scripts/flamegraph.py:        sh.sudo.rm(file_path)
tool/cstar_perf/tool/scripts/flamegraph.py:            sh.sudo.pkill('-f', '-9', process_line)
tool/cstar_perf/tool/scripts/utils.py:    sh.sudo.kill(pid)
vagrant/README.md:    ubuntu/debian: sudo apt-get install ssh
mambocab commented 8 years ago

I don't know enough about fabric to help with fab.sudo stuff yet to say what to change there. I think that the sh.sudo.X can be changed to sh.X, based on my understanding of how sh works.