mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Add option to reset Tautulli installation
This commit is contained in:
parent
2a3bd3413f
commit
96500f75b0
3 changed files with 64 additions and 6 deletions
|
@ -265,6 +265,19 @@
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Optional: The path to your git environment variable. Leave blank for default.</p>
|
<p class="help-block">Optional: The path to your git environment variable. Leave blank for default.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group advanced-setting">
|
||||||
|
<label>Repair Git Install</label>
|
||||||
|
<p class="help-block">
|
||||||
|
Attempt to fix updating by resetting your Tautulli installation to the latest "${config['git_remote']}/${config['git_branch']}" branch.
|
||||||
|
</p>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-form" type="button" id="reset_git_install">Reset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
||||||
|
@ -2154,6 +2167,13 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#reset_git_install").click(function () {
|
||||||
|
var msg = 'Are you sure you want to reset your Tautulli installtion?';
|
||||||
|
var url = 'reset_git_install';
|
||||||
|
confirmAjaxCall(url, msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#api_key').click(function(){ $('#api_key').select() });
|
$('#api_key').click(function(){ $('#api_key').select() });
|
||||||
$("#generate_api").click(function() {
|
$("#generate_api").click(function() {
|
||||||
$.get('generate_api_key',
|
$.get('generate_api_key',
|
||||||
|
|
|
@ -259,13 +259,10 @@ def update():
|
||||||
return
|
return
|
||||||
|
|
||||||
for line in output.split('\n'):
|
for line in output.split('\n'):
|
||||||
|
if 'Already up-to-date.' in line or 'Already up to date.' in line:
|
||||||
if 'Already up-to-date.' in line:
|
|
||||||
logger.info('No update available, not updating')
|
logger.info('No update available, not updating')
|
||||||
logger.info('Output: ' + str(output))
|
|
||||||
elif line.endswith(('Aborting', 'Aborting.')):
|
elif line.endswith(('Aborting', 'Aborting.')):
|
||||||
logger.error('Unable to update from git: ' + line)
|
logger.error('Unable to update from git: ' + line)
|
||||||
logger.info('Output: ' + str(output))
|
|
||||||
|
|
||||||
elif plexpy.INSTALL_TYPE == 'docker':
|
elif plexpy.INSTALL_TYPE == 'docker':
|
||||||
return
|
return
|
||||||
|
@ -331,6 +328,34 @@ def update():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def reset():
|
||||||
|
if plexpy.INSTALL_TYPE == 'git':
|
||||||
|
logger.info('Attempting to reset git install to "%s/%s"' % (plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
output, err = runGit('remote set-url {} https://github.com/{}/{}.git'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
plexpy.CONFIG.GIT_USER,
|
||||||
|
plexpy.CONFIG.GIT_REPO))
|
||||||
|
output, err = runGit('fetch {}'.format(plexpy.CONFIG.GIT_REMOTE))
|
||||||
|
output, err = runGit('checkout {}'.format(plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
output, err = runGit('branch -u {}/{}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
output, err = runGit('reset --hard {}/{}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
output, err = runGit('pull {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
|
||||||
|
if not output:
|
||||||
|
logger.error('Unable to reset Tautulli installation.')
|
||||||
|
return False
|
||||||
|
|
||||||
|
for line in output.split('\n'):
|
||||||
|
if 'Already up-to-date.' in line or 'Already up to date.' in line:
|
||||||
|
logger.info('Tautulli installation reset successfully.')
|
||||||
|
return True
|
||||||
|
elif line.endswith(('Aborting', 'Aborting.')):
|
||||||
|
logger.error('Unable to reset Tautulli installation: ' + line)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def checkout_git_branch():
|
def checkout_git_branch():
|
||||||
if plexpy.INSTALL_TYPE == 'git':
|
if plexpy.INSTALL_TYPE == 'git':
|
||||||
output, err = runGit('fetch %s' % plexpy.CONFIG.GIT_REMOTE)
|
output, err = runGit('fetch %s' % plexpy.CONFIG.GIT_REMOTE)
|
||||||
|
@ -343,9 +368,10 @@ def checkout_git_branch():
|
||||||
for line in output.split('\n'):
|
for line in output.split('\n'):
|
||||||
if line.endswith(('Aborting', 'Aborting.')):
|
if line.endswith(('Aborting', 'Aborting.')):
|
||||||
logger.error('Unable to checkout from git: ' + line)
|
logger.error('Unable to checkout from git: ' + line)
|
||||||
logger.info('Output: ' + str(output))
|
return
|
||||||
|
|
||||||
output, err = runGit('pull %s %s' % (plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH))
|
output, err = runGit('pull {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
plexpy.CONFIG.GIT_BRANCH))
|
||||||
|
|
||||||
|
|
||||||
def read_changelog(latest_only=False, since_prev_release=False):
|
def read_changelog(latest_only=False, since_prev_release=False):
|
||||||
|
|
|
@ -3916,6 +3916,18 @@ class WebInterface(object):
|
||||||
plexpy.CONFIG.write()
|
plexpy.CONFIG.write()
|
||||||
return self.do_state_change('checkout', 'Switching Git Branches', 120)
|
return self.do_state_change('checkout', 'Switching Git Branches', 120)
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
|
@requireAuth(member_of("admin"))
|
||||||
|
def reset_git_install(self, **kwargs):
|
||||||
|
result = versioncheck.reset()
|
||||||
|
|
||||||
|
if result:
|
||||||
|
return {'result': 'success', 'message': 'Tautulli installation reset.'}
|
||||||
|
else:
|
||||||
|
return {'result': 'error', 'message': 'Reset installation failed.'}
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def get_changelog(self, latest_only=False, since_prev_release=False, update_shown=False, **kwargs):
|
def get_changelog(self, latest_only=False, since_prev_release=False, update_shown=False, **kwargs):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue