Skip to content

Instantly share code, notes, and snippets.

View TheRealFalcon's full-sized avatar

James Falcon TheRealFalcon

  • CoreWeave
  • Kenosha, WI
View GitHub Profile
version: "2"
linters:
default: all
disable:
- depguard
- err113
- exhaustruct
- gochecknoglobals
- nlreturn
- nonamedreturns
# This script is a cloud-init userdata script that may be used to create a
# MAAS instance within an LXD VM, set up a custom MAAS image server with
# the cloud-init daily PPA installed, and launch an LXD VM from within
# the MAAS instance using the updated image.
# This script does not run quickly. Expect to wait 15+ minutes, even on
# reasonably fast hardware. The image build process is not fast at all.
# It requires several rounds of installing packages to set up dependencies.
# You can watch the progress with:
# $ lxc exec maas -- tail -f /var/log/cloud-init-output.log
#!/bin/bash
echo "test" > /var/tmp/test
from argparse import ArgumentParser
from typing import Dict, Type
from pycloudlib.cloud import BaseCloud
from pycloudlib.azure.cloud import Azure
from pycloudlib.ec2.cloud import EC2
from pycloudlib.gce.cloud import GCE
from pycloudlib.lxd.cloud import LXDContainer, LXDVirtualMachine
from pycloudlib.oci.cloud import OCI
from pycloudlib.openstack.cloud import Openstack

I have been trying to understand the behavior of apply_network_config in stages.py.

When trying to update the code to support configrable EventTypes, I noticed that we sometimes apply networking configuration twice.

apply_network_config only has two call points, both in main.py. The happy-path call gets called twice, once during local phase, then again during network phase.

Inside of the function, there is some logic to determine if we should apply networking config. One of these calls is self.is_new_instance(), which is a bit of a misnomer. It only returns True during the first local run. During the network phase run (still on first boot), it will return False.

Prior to the introduction of EventTypes (e.g., [commit 58581362](https://github.com/canonical/cloud-ini

@TheRealFalcon
TheRealFalcon / build.gradle
Created June 29, 2017 14:59
Simple gradle example
plugins {
id 'java'
id 'java-library'
id 'application'
id "com.github.johnrengelman.shadow" version "2.0.1"
}
group 'falcon'
version '1.0-SNAPSHOT'