Fix undefined names

This fixes apparent problems detected when F821 check is enabled.

./packstack/installer/core/drones.py:43:16: F821 undefined name 'ScriptRuntimeError'
        except ScriptRuntimeError as ex:
               ^
./packstack/installer/core/drones.py:313:9: F821 undefined name 'shutil'
        shutil.rmtree(self.local_tmpdir, ignore_errors=True)

./packstack/installer/run_setup.py:115:37: F821 undefined name 'raw_input'
                        userInput = raw_input(message.read())
                                    ^
./packstack/installer/run_setup.py:194:15: F821 undefined name 'raw_input'
        raw = raw_input(message.read())
              ^
./tests/installer/test_drones.py:82:23: F821 undefined name 'tarfile'
            tarball = tarfile.open(pack_path)
                      ^

Change-Id: Ie100fa47472c2bd55635d5b4a524cf9ef6671940
This commit is contained in:
Takashi Kajinami 2024-09-28 21:11:13 +09:00
parent 6253bb59ce
commit bd593b8df7
3 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@
# limitations under the License.
import os
import shutil
import stat
import uuid
import time
@ -40,7 +41,7 @@ class SshTarballTransferMixin(object):
"tar -C %(res_dir)s -xpzf %(pack_dest)s" % args)
try:
script.execute()
except ScriptRuntimeError as ex:
except utils.ScriptRuntimeError as ex:
# TO-DO: change to appropriate exception
raise RuntimeError('Failed to copy resources to node %s. '
'Reason: %s' % (node, ex))

View File

@ -112,7 +112,7 @@ def _getInputFromUser(param):
if (param.MASK_INPUT):
userInput = getpass.getpass("%s :" % (param.PROMPT))
else:
userInput = raw_input(message.read())
userInput = input(message.read())
else:
userInput = commandLineValues[param.CONF_NAME]
# If DEFAULT_VALUE is set and user did not input anything
@ -191,7 +191,7 @@ def _askYesNo(question=None):
message.write(askString)
message.seek(0)
raw = raw_input(message.read())
raw = input(message.read())
if not len(raw):
continue

View File

@ -17,6 +17,7 @@
import os
import shutil
import tarfile
import tempfile
from unittest import TestCase