fastcloudinit 0.0.1__tar.gz → 0.0.2__tar.gz

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.
@@ -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,2 @@
1
+ __version__ = "0.0.2"
2
+ from .core import *
@@ -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'),
@@ -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
@@ -1,16 +1,10 @@
1
1
  [DEFAULT]
2
- # All sections below are required unless otherwise specified.
3
- # See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
4
-
5
- ### Python library ###
6
2
  repo = fastcloudinit
7
- lib_name = %(repo)s
8
- version = 0.0.1
3
+ lib_name = fastcloudinit
4
+ version = 0.0.2
9
5
  min_python = 3.9
10
6
  license = apache2
11
7
  black_formatting = False
12
-
13
- ### nbdev ###
14
8
  doc_path = _docs
15
9
  lib_path = fastcloudinit
16
10
  nbs_path = nbs
@@ -19,29 +13,27 @@ tst_flags = notest
19
13
  put_version_in_init = True
20
14
  update_pyproject = True
21
15
  cell_number = False
22
-
23
- ### Docs ###
24
16
  branch = main
25
17
  custom_sidebar = False
26
- doc_host = https://%(user)s.github.io
27
- doc_baseurl = /%(repo)s
28
- git_url = https://github.com/%(user)s/%(repo)s
29
- title = %(lib_name)s
30
-
31
- ### PyPI ###
18
+ doc_host = https://AnswerDotAI.github.io
19
+ doc_baseurl = /fastcloudinit
20
+ git_url = https://github.com/AnswerDotAI/fastcloudinit
21
+ title = fastcloudinit
32
22
  audience = Developers
33
23
  author = Jeremy Howard
34
24
  author_email = github@jhoward.fastmail.fm
35
- copyright = 2025 onwards, %(author)s
25
+ copyright = 2025 onwards, Jeremy Howard
36
26
  description = Simplified opinionated cloud init for ubuntu
37
27
  keywords = nbdev jupyter notebook python
38
28
  language = English
39
29
  status = 3
40
30
  user = AnswerDotAI
41
31
  requirements = fastcore PyYAML
32
+ readme_nb = index.ipynb
33
+ allowed_metadata_keys =
34
+ allowed_cell_metadata_keys =
35
+ jupyter_hooks = False
36
+ clean_ids = True
37
+ clear_all = False
38
+ skip_procs =
42
39
 
43
- ### Optional ###
44
- # dev_requirements =
45
- # console_scripts =
46
- # conda_user =
47
- # package_data =
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.1"
2
- from .core import *
File without changes
File without changes
File without changes
File without changes
File without changes