connection: stop running chown all the time

We made a change not long ago in order to run chown if the
container user did not match the remote user.  This is running
all the time even if we're on metal.

This code optimizes it to avoid that extra call.

Change-Id: Ia97ee15b452f3d9496a0f575b8c482e9d6bf9018
This commit is contained in:
Mohammed Naser 2019-06-03 18:49:26 -04:00
parent f505b07fee
commit e085907160
1 changed files with 6 additions and 0 deletions

View File

@ -537,6 +537,12 @@ class Connection(SSH.Connection):
res = super(Connection, self).put_file(in_path, _out_path)
# NOTE(mnaser): If we're running without a container, we break out
# here to avoid the extra round-trip for the unnecessary
# chown.
if not self._container_check():
return res
# NOTE(pabelanger): Because we put_file as remote_user, it is possible
# that user doesn't exist inside the container, so use the root user to
# chown the file to container_user.