fastcloudinit 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fastcloudinit/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.0.1"
1
+ __version__ = "0.0.2"
2
2
  from .core import *
fastcloudinit/_modidx.py CHANGED
@@ -6,6 +6,7 @@ d = { 'settings': { 'branch': 'main',
6
6
  'git_url': 'https://github.com/AnswerDotAI/fastcloudinit',
7
7
  'lib_path': 'fastcloudinit'},
8
8
  'syms': { 'fastcloudinit.core': { 'fastcloudinit.core.apt': ('core.html#apt', 'fastcloudinit/core.py'),
9
+ 'fastcloudinit.core.cloud_init_base': ('core.html#cloud_init_base', 'fastcloudinit/core.py'),
9
10
  'fastcloudinit.core.cloud_init_config': ('core.html#cloud_init_config', 'fastcloudinit/core.py'),
10
11
  'fastcloudinit.core.log_rotate': ('core.html#log_rotate', 'fastcloudinit/core.py'),
11
12
  'fastcloudinit.core.mounts': ('core.html#mounts', 'fastcloudinit/core.py'),
fastcloudinit/core.py CHANGED
@@ -1,7 +1,8 @@
1
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
2
2
 
3
3
  # %% auto 0
4
- __all__ = ['ufw', 'user', 'source', 'apt', 'systemd', 'log_rotate', 'phone_home', 'reboot', 'mounts', 'cloud_init_config']
4
+ __all__ = ['ufw', 'user', 'source', 'apt', 'systemd', 'log_rotate', 'phone_home', 'reboot', 'mounts', 'cloud_init_config',
5
+ 'cloud_init_base']
5
6
 
6
7
  # %% ../nbs/00_core.ipynb
7
8
  from fastcore.utils import *
@@ -17,11 +18,11 @@ def ufw(logging="off", def_incoming="deny", def_outgoing="allow", internal=None,
17
18
  return dict(ufw=res)
18
19
 
19
20
  # %% ../nbs/00_core.ipynb
20
- def user(name, pub_key, groups=None, shell="/bin/bash", sudo=True):
21
+ def user(name, pub_keys, groups=None, shell="/bin/bash", sudo=True):
21
22
  groups = listify(groups)
22
23
  if sudo and 'sudo' not in groups: groups.append('sudo')
23
24
  sudo = ["ALL=(ALL) NOPASSWD:ALL"] if sudo else []
24
- return dict(name=name, groups=groups, shell=shell, sudo=sudo, ssh_authorized_keys=[pub_key])
25
+ return dict(name=name, groups=groups, shell=shell, sudo=sudo, ssh_authorized_keys=listify(pub_keys))
25
26
 
26
27
  # %% ../nbs/00_core.ipynb
27
28
  def source(url, keyid, keyserver):
@@ -79,19 +80,44 @@ def mounts(devices):
79
80
  return dict(mounts=devices)
80
81
 
81
82
  # %% ../nbs/00_core.ipynb
82
- def cloud_init_config(hostname, username, ssh_pub_key, email='',
83
- devices=None, ping_host=None, packages=None, **sources):
83
+ def cloud_init_config(hostname, username, pub_keys, email='',
84
+ devices=None, ping_host=None, packages=None, dropins=None, **sources):
85
+ if not dropins: dropins={}
84
86
  cfg = dict(
85
87
  hostname=hostname, preserve_hostname=False,
86
- users=[user(username, ssh_pub_key, groups="docker")],
88
+ users=[user(username, pub_keys, groups="docker")],
87
89
  packages=listify(packages), package_update=True, package_upgrade=True,
88
90
  disable_root=True, ssh_pwauth=False,
89
91
  **ufw(internal="enp7s0", OpenSSH=22),
90
92
  **apt(**sources),
91
- **systemd({"systemd-journald.service":"[Journal]\nSystemMaxUse=250M\n"}),
93
+ **systemd(dropins),
92
94
  write_files=[ log_rotate() ],
93
95
  **mounts(devices),
94
96
  **phone_home(ping_host),
95
97
  **reboot(),
96
98
  )
97
99
  return "#cloud-config\n" + yaml.safe_dump(cfg, sort_keys=False, width=1_000_000)
100
+
101
+ # %% ../nbs/00_core.ipynb
102
+ def cloud_init_base(hostname, packages=None, **kw):
103
+ cfg = dict(
104
+ hostname=hostname, preserve_hostname=False,
105
+ packages=listify(packages), package_update=True, package_upgrade=True,
106
+ disable_root=True, ssh_pwauth=False, **kw
107
+ )
108
+ return "#cloud-config\n" + yaml.safe_dump(cfg, sort_keys=False, width=1_000_000)
109
+
110
+ # %% ../nbs/00_core.ipynb
111
+ def cloud_init_config(hostname, username, pub_keys, email='', groups=None, internal=None,
112
+ devices=None, ping_host=None, packages=None, dropins=None, **sources):
113
+ return cloud_init_base(
114
+ hostname, packages=packages,
115
+ users=[user(username, pub_keys, groups=groups)],
116
+ **ufw(internal=internal, OpenSSH=22),
117
+ **apt(**sources),
118
+ **systemd(dropins or {}),
119
+ write_files=[ log_rotate() ],
120
+ **mounts(devices),
121
+ **phone_home(ping_host),
122
+ **reboot(),
123
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcloudinit
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Simplified opinionated cloud init for ubuntu
5
5
  Home-page: https://github.com/AnswerDotAI/fastcloudinit
6
6
  Author: Jeremy Howard
@@ -0,0 +1,9 @@
1
+ fastcloudinit/__init__.py,sha256=oDLMnoGVIAzRy6kwJGpxSDGyOG-aI7DiiERW6jGauWk,42
2
+ fastcloudinit/_modidx.py,sha256=v28JXqLC8cqigcrT4HY-6_t1uIg7dDOPgFjEyhq1abQ,1571
3
+ fastcloudinit/core.py,sha256=t9WCXVkdYpviF7mXFEtdqHeMoJ6cTOyJ3dHIRg3r18Q,4616
4
+ fastcloudinit-0.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ fastcloudinit-0.0.2.dist-info/METADATA,sha256=7nBT9t4-Tsu-zl3Y4V8j2gyhwQJ7b2IxSM_XhcHyx9k,1441
6
+ fastcloudinit-0.0.2.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
7
+ fastcloudinit-0.0.2.dist-info/entry_points.txt,sha256=VM6Nnsreaik0SzaZUuuwlWvlBKXIt35OXaFWekbNNY8,48
8
+ fastcloudinit-0.0.2.dist-info/top_level.txt,sha256=hVbcvprAQ-MXDFdjn5FkVecIwHYPMUikFR7aRiVHkt4,14
9
+ fastcloudinit-0.0.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- fastcloudinit/__init__.py,sha256=XoppFCWM_8XsGAbynKKKg7C3Mca0Kzf_ueJ_7U-l9SE,42
2
- fastcloudinit/_modidx.py,sha256=SIjb3ukADOIEBqTQq2etF_24_9Ntm-SejvJgpMD7Fw0,1441
3
- fastcloudinit/core.py,sha256=6K4EBWiSZ5SOMcvPjQux6GIacIXmA-Tyvleb02IhBeU,3663
4
- fastcloudinit-0.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- fastcloudinit-0.0.1.dist-info/METADATA,sha256=TVZrKjwG-6uicLfJ9iyp-cYaqNoIsixT2H8VcYHYdVs,1441
6
- fastcloudinit-0.0.1.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
7
- fastcloudinit-0.0.1.dist-info/entry_points.txt,sha256=VM6Nnsreaik0SzaZUuuwlWvlBKXIt35OXaFWekbNNY8,48
8
- fastcloudinit-0.0.1.dist-info/top_level.txt,sha256=hVbcvprAQ-MXDFdjn5FkVecIwHYPMUikFR7aRiVHkt4,14
9
- fastcloudinit-0.0.1.dist-info/RECORD,,