Skip to content

Commit

Permalink
fix workdir creation in agent binding modal, dont show users who have…
Browse files Browse the repository at this point in the history
…n't bound GitHub accounts in user auth modal in agent view
  • Loading branch information
wpbonelli committed Aug 24, 2021
1 parent 4b6d98e commit 761cb48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plantit/front_end/src/components/agents/agent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ export default {
otherUsers() {
return this.allUsers.filter(
u =>
u.username !== this.profile.djangoProfile.username &&
u.username !== this.profile.djangoProfile.username && u.github_profile !== undefined &&
!this.getAgent.users_authorized.some(
ua => ua.username === u.username
)
Expand Down
8 changes: 4 additions & 4 deletions plantit/front_end/src/components/agents/agents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@
"
>
You must have write permissions in the
chosen directory. A `.plantit` hidden
directory will be created and used to
store your tasks.
chosen directory. A hidden directory
named <code>.plantit</code> will be
created and used to store your tasks.
</p>
</b-col></b-row
></b-col
Expand Down Expand Up @@ -1291,7 +1291,7 @@ export default {
agentPort: 22,
agentUsername: '',
agentDescription: '',
agentWorkdir: '$HOME/.plantit',
agentWorkdir: '$HOME',
agentPrecommands:
'export LC_ALL=en_US.utf8 && export LANG=en_US.utf8',
agentMaxTime: 60,
Expand Down
5 changes: 2 additions & 3 deletions plantit/plantit/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ def check_connection(self, request):
ssh = SSH(hostname, port=port, username=username, password=request.data['password'])
else:
pkey = str(get_user_private_key_path(request.user.username))
self.logger.info(pkey)
ssh = SSH(hostname, port=port, username=username, pkey=pkey)

# subprocess.run(f"ssh-keyscan -H {hostname} >> ../config/ssh/known_hosts", shell=True)
Expand Down Expand Up @@ -363,9 +362,9 @@ def create_workdir(self, request):

with ssh:
try:
for line in execute_command(ssh=ssh, precommand=':', command=f"mkdir {workdir} && cd {workdir} && pwd", allow_stderr=False):
for line in execute_command(ssh=ssh, precommand=':', command=f"mkdir {workdir}/.plantit && cd {workdir}/.plantit && pwd", allow_stderr=False):
self.logger.info(line)
if 'cannot' in line: # TODO are there other error cases we should catch here?
if 'cannot' in line or '/.plantit' not in line: # TODO are there other error cases we should catch here?
return HttpResponse(line, status=500)
else:
return JsonResponse({'workdir': line.strip()})
Expand Down

0 comments on commit 761cb48

Please sign in to comment.