Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main nonwindows #72

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
39fd9e9
Remove --timzeone from burn raspberry and added support for detecting
rickotten Mar 26, 2021
2f6a8ad
Fixed bug where burn breaks if no workers are supplied
rickotten Mar 26, 2021
2702aef
Bump version: 4.3.17 → 4.3.18
laszewsk Mar 26, 2021
c8da930
add passlib
laszewsk Mar 26, 2021
4d7ab55
Merge branch 'main' into ubuntu
laszewsk Mar 26, 2021
85574e4
Bug Fixes + Download Image if not present
rickotten Mar 27, 2021
c1864de
Merge branch 'ubuntu' of github.com:cloudmesh/cloudmesh-pi-burn into …
rickotten Mar 27, 2021
91104f4
Fixed bug with --inventory arg
rickotten Mar 27, 2021
3402264
added safeguards for image downloading
rickotten Mar 28, 2021
f416461
default inventory and image downloading added to `burn ubuntu`
Mar 28, 2021
935aebd
Bump version: 4.3.19 → 4.3.20
laszewsk Mar 28, 2021
754e75e
flake8
Mar 28, 2021
7d2f73d
Merge branch 'ubuntu' of https://github.com/cloudmesh/cloudmesh-pi-bu…
Mar 28, 2021
568973c
Bump version: 4.3.20 → 4.3.21
laszewsk Mar 28, 2021
e841936
move some burn command logic into burner
rickotten Mar 29, 2021
35af32a
ubuntu updates
rickotten Mar 29, 2021
32b8068
Bump version: 4.3.21 → 4.3.22
laszewsk Mar 29, 2021
8173dc3
gui updated to support ubuntu
Mar 29, 2021
4887d4a
merge changes
Mar 29, 2021
a844f65
gui updated to support ubuntu
Mar 29, 2021
58dc343
gui updated to support ubuntu
Mar 29, 2021
422977a
gui updated to support ubuntu
Mar 29, 2021
b124cf0
flake8
Mar 29, 2021
94dea7d
Use wget python package instaed of cmdline
rickotten Mar 30, 2021
589c53d
More wget migrations
rickotten Mar 30, 2021
ebc3978
removed error if more than one card is detected on Mac but not necess…
rickotten Mar 30, 2021
85d8d97
Use Shell.download()
rickotten Mar 31, 2021
414521e
fix None country bug
Mar 31, 2021
bf41021
fix None country bug
Mar 31, 2021
622a04e
fix None country bug
Mar 31, 2021
a5538cf
Merge branch 'ubuntu' into main
laszewsk Apr 1, 2021
418a4d1
Bump version: 4.3.22 → 4.3.23
laszewsk Apr 1, 2021
df3e379
install libraspberrypi-bin by default to support `pi temp`
Apr 6, 2021
a3bc818
add downlaod update
laszewsk Apr 10, 2021
03ee5fd
spelling error
laszewsk Apr 10, 2021
40f7882
update FAQ
laszewsk Apr 10, 2021
a34059c
update readme
laszewsk Apr 10, 2021
b0e3d05
disable cloud-init after first boot
Apr 12, 2021
2d873f6
Merge branch 'main' of https://github.com/cloudmesh/cloudmesh-pi-burn…
Apr 15, 2021
0e15ac1
Merge branch 'ubuntu' of https://github.com/cloudmesh/cloudmesh-pi-bu…
Apr 15, 2021
df3b33b
Merge branch 'ubuntu' of github.com:cloudmesh/cloudmesh-pi-burn into …
laszewsk Apr 15, 2021
c0f2338
Bump version: 4.3.23 → 4.3.24
laszewsk Apr 15, 2021
9a02c63
Bump version: 4.3.24 → 4.3.25
laszewsk Apr 16, 2021
d6f9ed9
Bump version: 4.3.25 → 4.3.26
laszewsk Apr 16, 2021
4e17839
add banner and improve imports
laszewsk Apr 16, 2021
377b39a
Bump version: 4.3.26 → 4.3.27
laszewsk Apr 16, 2021
d5ef481
Bump version: 4.3.27 → 4.3.28
laszewsk May 6, 2021
ec302ed
Merge branch 'ubuntu' of github.com:cloudmesh/cloudmesh-pi-burn into …
laszewsk May 11, 2021
775a3f4
Merge branch 'ubuntu'
laszewsk May 11, 2021
257017f
Bump version: 4.3.28 → 4.3.29
laszewsk May 12, 2021
ad76a31
improve os.uname handling
laszewsk Sep 20, 2021
027be3a
bullseye patch to fix bridge and support burning 64 bit raspios
aporlowski Nov 12, 2021
c836df3
nftables update for ubuntu
aporlowski Nov 14, 2021
22e18de
Create tutorial_scrub.md
aporlowski Dec 2, 2021
5a5ee1f
Update tutorial_scrub.md
aporlowski Dec 8, 2021
e54267d
Update tutorial_scrub.md
aporlowski Dec 8, 2021
1e0602d
Update tutorial_scrub.md
aporlowski Dec 8, 2021
9d57e90
Update tutorial_scrub.md
aporlowski Dec 8, 2021
8004b0a
Update tutorial_scrub.md
aporlowski Dec 8, 2021
676e565
Update tutorial_scrub.md
aporlowski Dec 8, 2021
92d8dc7
Update README.md
aporlowski Dec 8, 2021
3a37231
Update tutorial_scrub.md
aporlowski Dec 8, 2021
1f424ba
Update tutorial_scrub.md
aporlowski Dec 8, 2021
165f66c
Update tutorial_scrub.md
aporlowski Dec 8, 2021
2393eff
added tag support for `latest-lite-legacy` and `latest-full-lecagy`
aporlowski Dec 8, 2021
14842ff
Merge remote-tracking branch 'origin/main' into main
aporlowski Dec 8, 2021
e090b1e
update license
laszewsk Feb 22, 2022
be6f28f
improve test file
laszewsk Mar 28, 2022
e97ac40
update version list
laszewsk Apr 8, 2022
0d080c0
fix xz encoding for versions
laszewsk Apr 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 4.3.19
current_version = 4.3.29
commit = True
tag = False

Expand Down
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Version 2.0, January 2004
http://www.apache.org/licenses/

Copyright 2017 Gregor von Laszewski, Indiana University
Copyright 2017-2021 Gregor von Laszewski, Indiana University
Copyright 2021,2022 Gregor von Laszewski, University of Virginia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
722 changes: 169 additions & 553 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.19
4.3.29
6 changes: 5 additions & 1 deletion cloudmesh/burn/Iso.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
# import wget

from cloudmesh.burn.image import Image
from cloudmesh.common.Shell import Shell


class Iso:
Expand All @@ -13,4 +15,6 @@ def get(tag="latest"):
url = Iso.distribution[tag]
destination = Image().directory + os.path.basename(url)

os.system(f'wget -O {destination} {url}')
Shell.download(url, destination, provider='system')
# wget.download(url, out=destination)
# os.system(f'wget -O {destination} {url}')
2 changes: 1 addition & 1 deletion cloudmesh/burn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.3.19"
__version__ = "4.3.29"
2 changes: 1 addition & 1 deletion cloudmesh/burn/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "4.3.19"
version = "4.3.29"
10 changes: 6 additions & 4 deletions cloudmesh/burn/burner/Burner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
# import wget

from cloudmesh.burn.burner.raspberryos import Burner as RaspberryOsBurner
from cloudmesh.burn.usb import USB
Expand Down Expand Up @@ -53,11 +54,12 @@ def install(self):
return ""
else:
banner("Installing pishrink.sh into /usr/local/bin")
script_name = Shell.download(
'https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh', 'pishrink.sh', provider='system')
script = \
"""
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
f"""
chmod +x {script_name}
sudo mv {script_name} /usr/local/bin
"""

result = JobScript.execute(script)
Expand Down
95 changes: 78 additions & 17 deletions cloudmesh/burn/burner/RaspberryBurner.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import os
import time
from getpass import getpass

from cloudmesh.burn.burner.BurnerABC import AbstractBurner
from cloudmesh.burn.image import Image
from cloudmesh.burn.raspberryos.cmdline import Cmdline
from cloudmesh.burn.raspberryos.runfirst import Runfirst
from cloudmesh.burn.sdcard import SDCard
from cloudmesh.burn.usb import USB
from cloudmesh.burn.wifi.ssid import get_ssid
from cloudmesh.common.Host import Host
from cloudmesh.common.Shell import Shell
from cloudmesh.common.console import Console
from cloudmesh.common.parameter import Parameter
from cloudmesh.common.util import yn_choice, readfile
from cloudmesh.common.util import banner
from cloudmesh.common.util import path_expand
from cloudmesh.common.util import readfile
from cloudmesh.common.util import yn_choice
from cloudmesh.inventory.inventory import Inventory


Expand All @@ -17,21 +26,78 @@ class Burner(AbstractBurner):

Inventory should contain information on manager and workers
"""
def __init__(self, inventory=None):
def __init__(self, inventory=None, names=None, ssid=None,
wifipassword=None, force_inv=False, country=None):
# Get inventory
self.ssid = ssid
self.wifipasswd = wifipassword
if inventory is None:
inv = Inventory()
names = Parameter.expand(names)
manager, workers = Host.get_hostnames(names)
if workers:
worker_base_name = ''.join(
[i for i in workers[0] if not i.isdigit()])

cluster_name = manager or worker_base_name
inventory = path_expand(f'~/.cloudmesh/inventory-{cluster_name}.yaml')

if not os.path.exists(inventory) or force_inv:
if not manager:
Console.error("No inventory found. Can not create an "
"inventory without a "
"manager.")
return ""

Inventory.build_default_inventory(filename=inventory,
manager=manager,
workers=workers)
inv = Inventory(filename=inventory)

else:
inv = Inventory(filename=inventory)
self.inventory = inv

# Find managers and workers
managers = inv.find(service='manager')
if len(managers) > 0:
if not self.ssid:
self.ssid = get_ssid()
if self.ssid == "":
Console.info('Could not determine SSID, skipping wifi '
'config')
self.ssid = None
if not self.wifipasswd and self.ssid:
self.wifipasswd = getpass(f"Using --SSID={self.ssid}, please "
f"enter wifi password:")
workers = inv.find(service='worker')

# No inherenet need to distinguish the configs by service
configs = managers + workers
# Create dict for them for easy lookup
self.configs = dict((config['host'], config) for config in configs)
self.get_images()
self.country = country if country else Shell.locale().upper()

def get_images(self):
"""
Downloads all tags found in self.configs
"""
tags = set()
for config in self.configs.values():
try:
tags.add(config['tag'])
except KeyError as e:
Console.warning(f'Could not find tag for {config["host"]}. Skipping')

banner("Downloading Images", figlet=True)

image = Image()

for tag in tags:
Console.info(f'Attempting to download {tag}')
res = image.fetch(tag=[tag])
if not res:
Console.error('Failed Image Fetch.')
raise Exception('Failed Image Fetch')

def cluster(self, arguments=None):
raise NotImplementedError
Expand All @@ -41,9 +107,7 @@ def burn(self,
device=None,
verbose=False,
password=None,
ssid=None,
wifipasswd=None,
country=None):
):
"""
Given the name of a config, burn device with RaspberryOS and configure properly
"""
Expand All @@ -68,6 +132,8 @@ def burn(self,
print()
return ""

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

# Confirm card is inserted into device path
if not yn_choice(f'Is the card to be burned for {name} inserted?'):
if not yn_choice(f"Please insert the card to be burned for {name}. "
Expand Down Expand Up @@ -103,8 +169,8 @@ def burn(self,
runfirst.set_password(password=password)

runfirst.set_locale(timezone=config['timezone'], locale=config['locale'])
if ssid:
runfirst.set_wifi(ssid, wifipasswd, country=country)
if self.ssid and 'wifi' in config['services']:
runfirst.set_wifi(self.ssid, self.wifipasswd, self.country)

runfirst.set_key(key=readfile(config['keyfile']).strip())
if 'bridge' in config['services']:
Expand All @@ -120,16 +186,14 @@ def burn(self,
return

def inventory(self, arguments=None):
raise NotImplementedError
return self.inventory

def multi_burn(self,
names=None,
devices=None,
verbose=False,
password=None,
ssid=None,
wifipasswd=None,
country=None):
):
"""
Given multiple names, burn them
"""
Expand All @@ -152,10 +216,7 @@ def multi_burn(self,
name=name,
device=devices[0],
verbose=verbose,
password=password,
ssid=ssid,
wifipasswd=wifipasswd,
country=None
password=password
)
Console.ok('Finished burning all cards')

Expand Down
Loading