Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
laszewsk committed May 4, 2022
1 parent 7267829 commit 4733ef8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 34 deletions.
4 changes: 1 addition & 3 deletions cloudmesh/burn/burner/RaspberryBurner.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ def burn(self,

print(runfirst.script)


banner(txt=f"Burn {name}", figlet=True)

card = SDCard().info(print_os=False,print_stdout=False)
card = SDCard().info(print_os=False, print_stdout=False)
if device not in card:
label = "device"

Expand All @@ -137,7 +136,6 @@ def burn(self,

Console.info(f'Burning {name}')


if os_is_windows():
if withimage:
sdcard.format_device(device=device, unmount=True)
Expand Down
12 changes: 4 additions & 8 deletions cloudmesh/burn/command/burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ def do_burn(self, args, arguments):
"no_image",
"new")


# arguments.MOUNTPOINT = arguments["--mount"]
arguments.FORMAT = arguments["--format"]
arguments.FROM = arguments["--from"]
Expand All @@ -407,7 +406,6 @@ def do_burn(self, args, arguments):
if len(arguments.TAG) == 0:
arguments.TAG = "latest"


# VERBOSE(arguments)

def execute(label, function):
Expand Down Expand Up @@ -524,7 +522,7 @@ def execute(label, function):
# timezone = timezone.replace("-", "//")

timezone = timezone.strip()
print ("AAA timezone: ", timezone)
print("AAA timezone: ", timezone)

locale = arguments.locale or "en_US.UTF-8"
locale = locale.strip()
Expand All @@ -548,8 +546,7 @@ def execute(label, function):
images=arguments.tag,
timezone=timezone,
network=network)
print ("OOO", inventory)

print("OOO", inventory)

burner = RaspberryBurner(inventory=inventory)

Expand All @@ -565,12 +562,11 @@ def execute(label, function):
if os_is_windows():
os.system("stty -echo")
wifipasswd = input(f"Using --SSID={ssid}, please "
f"enter wifi password:")
f"enter wifi password:")
os.system("stty echo")
print("")
else:
wifipasswd = getpass(f"Using --SSID={ssid}, please "
f"enter wifi password:")
wifipasswd = getpass(f"Using --SSID={ssid}, please enter wifi password:")

execute("burn raspberry", burner.multi_burn(
names=arguments.NAMES,
Expand Down
8 changes: 4 additions & 4 deletions cloudmesh/burn/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def find(tag=None):
:rtype: dict
"""
tag = tag or ['latest-lite']
if not isinstance(tag,list):
if not isinstance(tag, list):
tag = [tag]
found = []
data = Image.create_version_cache(refresh=False)
Expand Down Expand Up @@ -240,7 +240,7 @@ def fetch_kind(kind=None):
data = yaml.safe_load(readfile(cache))
# convert to array
result = data["lite"] + data["full"] + \
data["lite-32"] + data["full-32"] + \
data["lite-32"] + data["full-32"] + \
data["lite-64"] + data["full-64"] + \
data["lite-legacy"] + data["full-legacy"] + \
Ubuntu.distribution
Expand Down Expand Up @@ -468,7 +468,7 @@ def ls(self):
List all downloaded images
"""
images_dir = Path(self.directory)
images = [str(x).replace(self.directory + '/', '') # .replace('.img', '')
images = [str(x).replace(self.directory + '/', '') # .replace('.img', '')
for x in images_dir.glob('*.img')]

banner(f'Available Images in {self.directory}')
Expand All @@ -490,7 +490,7 @@ def clear(self):
for name in self.names():
try:
path = Path(Path(self.directory) / Path(name))
print (path)
print(path)
path.unlink()

except Exception as e: # noqa: F841
Expand Down
2 changes: 1 addition & 1 deletion cloudmesh/burn/raspberryos/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self):
self.template["lite-64"] = self.template["lite"]
self.template["full-64"] = self.template["full"]

# Commented out above since we should just append
# Commented out above since we should just append
# the lines below to the existing cmdline.txt since
# root PARTUUID may vary

Expand Down
1 change: 0 additions & 1 deletion cloudmesh/burn/raspberryos/passwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Passwd:

file = textwrap.dedent("""
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
Expand Down
3 changes: 2 additions & 1 deletion cloudmesh/burn/raspberryos/runfirst.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def _get_bridge_script_nftables(self):
script += ['sudo nft add chain ip filter FORWARD "{ type filter hook forward priority 0; policy accept; }"']
script += ['sudo nft add chain ip filter OUTPUT "{ type filter hook output priority 0; policy accept; }"']
script += ['sudo nft add rule ip filter FORWARD iifname "eth0" oifname "wlan0" counter accept']
script += ['sudo nft add rule ip filter FORWARD iifname "wlan0" oifname "eth0" ct state related,established counter accept']
script += [
'sudo nft add rule ip filter FORWARD iifname "wlan0" oifname "eth0" ct state related,established counter accept']
script += ['sudo nft add table ip nat']
script += ['sudo nft add chain ip nat PREROUTING "{ type nat hook prerouting priority -100; policy accept; }"']
script += ['sudo nft add chain ip nat INPUT "{ type nat hook input priority 100; policy accept; }"']
Expand Down
1 change: 0 additions & 1 deletion cloudmesh/burn/raspberryos/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
print(cmsline.get())
print()


names = Parameter.expand("red,red[0-1]")
ips = Parameter.expand("10.0.0.[1-3]")

Expand Down
23 changes: 11 additions & 12 deletions cloudmesh/burn/sdcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def burn_sdcard(self,
:type yes: str
"""
print ("OOOO", name, tag)
print("OOOO", name, tag)
if image and tag:
Console.error("Implementation error, burn_sdcard can't have image "
"and tag.")
Expand Down Expand Up @@ -855,7 +855,6 @@ def burn_sdcard(self,
print(image_path)

if not os.path.isfile(image_path):

print()
Console.error(f"Image with tag '{tag}' not found. To download use")
print()
Expand Down Expand Up @@ -1018,15 +1017,15 @@ def info(self,
"Size",
"Status",
], header=[
"Disk",
"InterfaceType",
"MediaType",
"Model",
"Model",
"Partitions",
"Size",
"Status",
])
"Disk",
"InterfaceType",
"MediaType",
"Model",
"Model",
"Partitions",
"Size",
"Status",
])
)

details = USB.get_from_usb()
Expand Down Expand Up @@ -1071,7 +1070,7 @@ def info(self,
else:
details = USB.get_from_dmesg()

details = [d for d in details if d['info'] not in ['ATA']]
details = [d for d in details if d['info'] not in ['ATA']]
if print_stdout and not os_is_windows():
banner("SD Cards Found")

Expand Down
4 changes: 1 addition & 3 deletions cloudmesh/burn/windowssdcard.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import string
import subprocess
import sys
import time
from pathlib import Path
from pprint import pprint
from pathlib import PurePosixPath
import io

Expand Down Expand Up @@ -535,7 +533,7 @@ def run(command):
:rtype: str
"""
_diskpart = Path("C:/Windows/system32/diskpart.exe")
#TODO IS THIS BUGFIX CORRECT?
# TODO IS THIS BUGFIX CORRECT?
_diskpart = path_expand("C:/Windows/system32/diskpart.exe")
common_writefile(Diskpart.tmp, f"{command}\nexit")
result = Shell.run(f"{_diskpart} /s {Diskpart.tmp}")
Expand Down

0 comments on commit 4733ef8

Please sign in to comment.