FIX: oct number issue for Python 2/3 compatible code
change 00xxx or 0xxx to 0oxxx remove ignore of H232 for flake8 H232: Python 3.x incompatible octal 400 should be written as 0o400 Story: 2003433 Task: 28473 Change-Id: I130695aa0ab7b1fc4692eb232315445d6273e100 Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
68c67e50fa
commit
38e4717354
|
@ -640,7 +640,7 @@ def backup_ldap(archive, staging_dir):
|
|||
""" Backup ldap configuration """
|
||||
try:
|
||||
ldap_staging_dir = staging_dir + '/ldap'
|
||||
os.mkdir(ldap_staging_dir, 0655)
|
||||
os.mkdir(ldap_staging_dir, 0o655)
|
||||
|
||||
subprocess.check_call([
|
||||
'slapcat', '-d', '0', '-F', '/etc/openldap/schema',
|
||||
|
@ -727,7 +727,7 @@ def backup_postgres(archive, staging_dir, cinder_config=False):
|
|||
""" Backup postgres configuration """
|
||||
try:
|
||||
postgres_staging_dir = staging_dir + '/postgres'
|
||||
os.mkdir(postgres_staging_dir, 0655)
|
||||
os.mkdir(postgres_staging_dir, 0o655)
|
||||
|
||||
# Backup roles, table spaces and schemas for databases.
|
||||
subprocess.check_call([('sudo -u postgres pg_dumpall --clean ' +
|
||||
|
@ -903,7 +903,7 @@ def backup_ceph_crush_map(archive, staging_dir):
|
|||
""" Backup ceph crush map """
|
||||
try:
|
||||
ceph_staging_dir = os.path.join(staging_dir, 'ceph')
|
||||
os.mkdir(ceph_staging_dir, 0655)
|
||||
os.mkdir(ceph_staging_dir, 0o655)
|
||||
crushmap_file = os.path.join(ceph_staging_dir,
|
||||
sysinv_constants.CEPH_CRUSH_MAP_BACKUP)
|
||||
subprocess.check_call(['ceph', 'osd', 'getcrushmap',
|
||||
|
|
|
@ -320,7 +320,7 @@ def create_iso(iso_name, archive_dir):
|
|||
try:
|
||||
# prepare the iso files
|
||||
images_dir = os.path.join(iso_dir, 'images')
|
||||
os.mkdir(images_dir, 0644)
|
||||
os.mkdir(images_dir, 0o644)
|
||||
pxe_dir = os.path.join('/pxeboot',
|
||||
'rel-' + tsconfig.SW_VERSION)
|
||||
os.symlink(pxe_dir + '/installer-bzImage',
|
||||
|
@ -347,7 +347,7 @@ def create_iso(iso_name, archive_dir):
|
|||
step += 1
|
||||
|
||||
efiboot_dir = os.path.join(iso_dir, 'EFI', 'BOOT')
|
||||
os.makedirs(efiboot_dir, 0644)
|
||||
os.makedirs(efiboot_dir, 0o644)
|
||||
l_efi_dir = os.path.join('/boot', 'efi', 'EFI')
|
||||
shutil.copy2(l_efi_dir + '/BOOT/BOOTX64.EFI', efiboot_dir)
|
||||
shutil.copy2(l_efi_dir + '/centos/MokManager.efi', efiboot_dir)
|
||||
|
@ -420,7 +420,7 @@ def create_iso(iso_name, archive_dir):
|
|||
|
||||
create_ini_file(clone_archive_dir, iso_name)
|
||||
|
||||
os.chmod(iso_dir + '/isolinux.bin', 0664)
|
||||
os.chmod(iso_dir + '/isolinux.bin', 0o664)
|
||||
iso_file = os.path.join(archive_dir, iso_name + ".iso")
|
||||
output = subprocess.check_output(
|
||||
["nice", "mkisofs",
|
||||
|
@ -702,7 +702,7 @@ def clone(backup_name, archive_dir):
|
|||
if os.path.exists(isolinux_dir):
|
||||
LOG.info("deleting old iso_dir %s" % isolinux_dir)
|
||||
shutil.rmtree(isolinux_dir, ignore_errors=True)
|
||||
os.makedirs(clone_archive_dir, 0644)
|
||||
os.makedirs(clone_archive_dir, 0o644)
|
||||
|
||||
try:
|
||||
backup_restore.backup(backup_name, clone_archive_dir, clone=True)
|
||||
|
|
|
@ -248,7 +248,7 @@ def cleanup():
|
|||
if os.path.exists(OLD_FILE):
|
||||
os.remove(OLD_FILE)
|
||||
if os.path.exists(INI_FILE):
|
||||
os.chmod(INI_FILE, 0400)
|
||||
os.chmod(INI_FILE, 0o400)
|
||||
shutil.move(INI_FILE, tsconfig.PLATFORM_CONF_PATH)
|
||||
shutil.rmtree(os.path.join("/", clone.CLONE_ARCHIVE_DIR),
|
||||
ignore_errors=True)
|
||||
|
|
|
@ -38,7 +38,6 @@ commands = flake8 {posargs}
|
|||
# H101: Use TODO(NAME)
|
||||
# H102: Apache 2.0 license header not found
|
||||
# H104: File contains nothing but comments
|
||||
# H232: Python 3.x incompatible octal 400 should be written as 0o400
|
||||
# H238: old style class declaration, use new style (inherit from `object`)
|
||||
# H301: one import per line
|
||||
# H306: imports not in alphabetical order
|
||||
|
@ -46,7 +45,7 @@ commands = flake8 {posargs}
|
|||
# H403: multi line docstrings should end on a new line
|
||||
# H404: multi line docstring should start without a leading new line
|
||||
# H405: multi line docstring summary not separated with an empty line
|
||||
ignore = H101,H102,H104,H232,H238,H301,H306,H401,H403,H404,H405
|
||||
ignore = H101,H102,H104,H238,H301,H306,H401,H403,H404,H405
|
||||
exclude = build
|
||||
|
||||
[testenv:py27]
|
||||
|
|
|
@ -32,7 +32,7 @@ LOG = log.getLogger(__name__)
|
|||
@contextmanager
|
||||
def TempDirectory():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
saved_umask = os.umask(0077)
|
||||
saved_umask = os.umask(0o077)
|
||||
try:
|
||||
yield tmpdir
|
||||
finally:
|
||||
|
|
|
@ -842,7 +842,7 @@ class AppOperator(object):
|
|||
LOG.info("Application overrides generated.")
|
||||
# Ensure all chart overrides are readable by Armada
|
||||
for file in overrides_files:
|
||||
os.chmod(file, 0644)
|
||||
os.chmod(file, 0o644)
|
||||
overrides_str =\
|
||||
self._generate_armada_overrides_str(overrides_files)
|
||||
self._update_app_status(
|
||||
|
|
|
@ -73,7 +73,7 @@ commands =
|
|||
# H701 Empty localization string
|
||||
# H702 Formatting operation should be outside of localization method call
|
||||
# H703 Multiple positional placeholders
|
||||
ignore = E126,E127,E128,E226,E402,E501,H101,H102,H104,H105,H232,H236,H237,H238,H301,H306,H401,H403,H404,H405,H501,H701,H702,H703
|
||||
ignore = E126,E127,E128,E226,E402,E501,H101,H102,H104,H105,H236,H237,H238,H301,H306,H401,H403,H404,H405,H501,H701,H702,H703
|
||||
exclude = build,dist
|
||||
|
||||
[testenv:flake8]
|
||||
|
|
Loading…
Reference in New Issue