[Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master
Dan Watkins has proposed merging ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master. Commit message: cc_set_passwords: rewrite documentation What we had previously was inaccurate in a few respects. LP: #1838794 Requested reviews: Server Team CI bot (server-team-bot): continuous-integration cloud-init commiters (cloud-init-dev) Related bugs: Bug #1838794 in cloud-init: "Set Passwords documentation describes incorrect behaviour for `password` config key" https://bugs.launchpad.net/cloud-init/+bug/1838794 For more details, see: https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/370927 -- Your team cloud-init commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master. diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index 4585e4d..debdee4 100755 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -9,27 +9,39 @@ """ Set Passwords - -**Summary:** Set user passwords - -Set system passwords and enable or disable ssh password authentication. -The ``chpasswd`` config key accepts a dictionary containing a single one of two -keys, either ``expire`` or ``list``. If ``expire`` is specified and is set to -``false``, then the ``password`` global config key is used as the password for -all user accounts. If the ``expire`` key is specified and is set to ``true`` -then user passwords will be expired, preventing the default system passwords -from being used. - -If the ``list`` key is provided, a list of -``username:password`` pairs can be specified. The usernames specified -must already exist on the system, or have been created using the -``cc_users_groups`` module. A password can be randomly generated using -``username:RANDOM`` or ``username:R``. A hashed password can be specified -using ``username:$6$salt$hash``. Password ssh authentication can be -enabled, disabled, or left to system defaults using ``ssh_pwauth``. +**Summary:** Set user passwords and enable/disable SSH password authentication + +This module consumes three top-level config keys: ``ssh_pwauth``, ``chpasswd`` +and ``password``. + +The ``ssh_pwauth`` config key determines whether or not sshd will be configured +to accept password authentication. True values will enable password auth, +false values will disable password auth, and the literal string ``unchanged`` +will leave it unchanged. Setting no value will also leave the current setting +on-disk unchanged. + +The ``chpasswd`` config key accepts a dictionary containing either or both of +``expire`` and ``list``. + +If the ``list`` key is provided, it should contain a list of +``username:password`` pairs. This can be either a YAML list (of strings), or a +multi-line string with one pair per line. Each user will have the +corresponding password set. A password can be randomly generated by specifying +``RANDOM`` or ``R`` as a user's password. A hashed password, created by a tool +like ``mkpasswd``, can be specified; a regex (``r'\$(1|2a|2y|5|6)(\$.+){2}'``) +is used to determine if a password value should be treated as a hash. .. note:: -if using ``expire: true`` then a ssh authkey should be specified or it may -not be possible to login to the system +The users specified must already exist on the system. Users will have been +created by the ``cc_users_groups`` module at this point. + +By default, all users on the system will have their passwords expired (meaning +that they will have to be reset the next time the user logs in). To disable +this behaviour, set ``expire`` under ``chpasswd`` to a false value. + +If a ``list`` of user/password pairs is not specified under ``chpasswd``, then +the value of the ``password`` config key will be used to set the default user's +password. **Internal name:** ``cc_set_passwords`` @@ -160,6 +172,8 @@ def handle(_name, cfg, cloud, log, args): hashed_users = [] randlist = [] users = [] +# N.B. This regex is included in the documentation (i.e. the module +# docstring), so any changes to it should be reflected there. prog = re.compile(r'\$(1|2a|2y|5|6)(\$.+){2}') for line in plist: u, p = line.split(':', 1) ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master
Diff comments: > diff --git a/cloudinit/config/cc_set_passwords.py > b/cloudinit/config/cc_set_passwords.py > index 4585e4d..10d68ea 100755 > --- a/cloudinit/config/cc_set_passwords.py > +++ b/cloudinit/config/cc_set_passwords.py > @@ -9,27 +9,38 @@ > """ > Set Passwords > - > -**Summary:** Set user passwords > - > -Set system passwords and enable or disable ssh password authentication. > -The ``chpasswd`` config key accepts a dictionary containing a single one of > two > -keys, either ``expire`` or ``list``. If ``expire`` is specified and is set to > -``false``, then the ``password`` global config key is used as the password > for > -all user accounts. If the ``expire`` key is specified and is set to ``true`` > -then user passwords will be expired, preventing the default system passwords > -from being used. > - > -If the ``list`` key is provided, a list of > -``username:password`` pairs can be specified. The usernames specified > -must already exist on the system, or have been created using the > -``cc_users_groups`` module. A password can be randomly generated using > -``username:RANDOM`` or ``username:R``. A hashed password can be specified > -using ``username:$6$salt$hash``. Password ssh authentication can be > -enabled, disabled, or left to system defaults using ``ssh_pwauth``. > +**Summary:** Set user passwords and enable/disable SSH password > authentication > + > +This module consumes three top-level config keys: ``ssh_pwauth``, > ``chpasswd`` > +and ``password``. > + > +The ``ssh_pwauth`` config key determines whether or not sshd will be > configured > +to accept password authentication. True values will enable password auth, > +false values will disable password auth, and the literal string ``unchanged`` > +will leave it unchanged. Setting no value will also leave the current > setting > +on-disk unchanged. > + > +The ``chpasswd`` config key accepts a dictionary containing either or both of > +``expire`` and ``list``. > + > +If the ``list`` key is provided, it should contain a list of > +``username:password`` pairs. This can be either a YAML list (of strings), > or a > +multi-line string with one pair per line. Each user will have the > +corresponding password set. A password can be randomly generated by > specifying > +``RANDOM`` or ``R`` as a user's password. A hashed password can be specified > +using ``$6$salt$hash`` as a user's password. Yep, let me rework this. > > .. note:: > -if using ``expire: true`` then a ssh authkey should be specified or it > may > -not be possible to login to the system > +The users specified must already exist on the system. Users will have > been > +created by the ``cc_users_groups`` module at this point. > + > +By default, all users on the system will have their passwords expired > (meaning > +that they will have to be reset the next time the user logs in). To disable > +this behaviour, set ``expire`` under ``chpasswd`` to a false value. > + > +If a ``list`` of user/password pairs is not specified under ``chpasswd``, > then > +the value of the ``password`` config key will be used to set the default > user's > +password. > > **Internal name:** ``cc_set_passwords`` > -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/370927 Your team cloud-init commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master
The proposal to merge ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master has been updated. Status: Needs review => Work in progress For more details, see: https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/370927 -- Your team cloud-init commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master has been updated. Status: Needs review => Work in progress For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792 -- Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ('~chad.smith/cloud-init', ':', 'feature/azure-to-network-v2') into ('cloud-init', ':', 'master')
Review: Needs Fixing continuous-integration FAILED: Continuous integration, rev:9af66a67ecc80685544fd0847884ab7ea6a5d644 https://jenkins.ubuntu.com/server/job/cloud-init-ci/1028/ Executed test runs: SUCCESS: Checkout FAILED: Unit & Style Tests Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1028//rebuild -- https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
Diff comments: > diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py > index 0ca576b..c0c415d 100644 > --- a/cloudinit/net/network_state.py > +++ b/cloudinit/net/network_state.py > @@ -596,6 +596,7 @@ class NetworkStateInterpreter(object): >eno1: > match: >macaddress: 00:11:22:33:44:55 > + driver: hv_netsvc ohh was just a docstring addition, wanted a more complete reference. > wakeonlan: true > dhcp4: true > dhcp6: false > diff --git a/tests/unittests/test_datasource/test_azure.py > b/tests/unittests/test_datasource/test_azure.py > index 2de2aea..3ed9e4e 100644 > --- a/tests/unittests/test_datasource/test_azure.py > +++ b/tests/unittests/test_datasource/test_azure.py > @@ -997,7 +997,7 @@ scbus-1 on xpt0 bus 0 > netconfig = dsrc.network_config > self.assertEqual(netconfig, fallback_config) > mock_fallback.assert_called_with(blacklist_drivers=['mlx4_core'], > - config_driver=True) > + config_driver=True, > network_version=2) oops. that should have failed/ > > @mock.patch('cloudinit.net.get_interface_mac') > @mock.patch('cloudinit.net.get_devicelist') > diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py > index 1840ade..4f7e420 100644 > --- a/tests/unittests/test_net.py > +++ b/tests/unittests/test_net.py > @@ -2156,7 +2156,7 @@ DEFAULT_DEV_ATTRS = { > "carrier": False, > "dormant": False, > "operstate": "down", > -"address": "07-1C-C6-75-A4-BE", > +"address": "07-1c-c6-75-a4-be", only because out netplan we generate in other cases was lowercase. I don't have to, just wanted it to the the same case for !fallback > "device/driver": None, > "device/device": None, > "name_assign_type": "4", > @@ -3342,13 +3375,13 @@ class TestNetplanNetRendering(CiTestCase): > > expected = """ > network: > -version: 2 > ethernets: > eth1000: > dhcp4: true > match: > macaddress: 07-1c-c6-75-a4-be > set-name: eth1000 > +version: 2 Because we are rendering directly from network v2 using yaml dump without ordering rules instead of converting from v1 to v2 with a helper function which intentionally ordered the output with version key first. > """ > self.assertEqual(expected.lstrip(), contents.lstrip()) > self.assertEqual(1, mock_clean_default.call_count) -- https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
One debugging line needs removing and some questions inline. Diff comments: > diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py > index 0ca576b..c0c415d 100644 > --- a/cloudinit/net/network_state.py > +++ b/cloudinit/net/network_state.py > @@ -596,6 +596,7 @@ class NetworkStateInterpreter(object): >eno1: > match: >macaddress: 00:11:22:33:44:55 > + driver: hv_netsvc Debugging code? > wakeonlan: true > dhcp4: true > dhcp6: false > diff --git a/tests/unittests/test_datasource/test_azure.py > b/tests/unittests/test_datasource/test_azure.py > index 2de2aea..3ed9e4e 100644 > --- a/tests/unittests/test_datasource/test_azure.py > +++ b/tests/unittests/test_datasource/test_azure.py > @@ -997,7 +997,7 @@ scbus-1 on xpt0 bus 0 > netconfig = dsrc.network_config > self.assertEqual(netconfig, fallback_config) > mock_fallback.assert_called_with(blacklist_drivers=['mlx4_core'], > - config_driver=True) > + config_driver=True, > network_version=2) We don't need this any more right? > > @mock.patch('cloudinit.net.get_interface_mac') > @mock.patch('cloudinit.net.get_devicelist') > diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py > index 1840ade..4f7e420 100644 > --- a/tests/unittests/test_net.py > +++ b/tests/unittests/test_net.py > @@ -2156,7 +2156,7 @@ DEFAULT_DEV_ATTRS = { > "carrier": False, > "dormant": False, > "operstate": "down", > -"address": "07-1C-C6-75-A4-BE", > +"address": "07-1c-c6-75-a4-be", Why change this? > "device/driver": None, > "device/device": None, > "name_assign_type": "4", > @@ -3342,13 +3375,13 @@ class TestNetplanNetRendering(CiTestCase): > > expected = """ > network: > -version: 2 > ethernets: > eth1000: > dhcp4: true > match: > macaddress: 07-1c-c6-75-a4-be > set-name: eth1000 > +version: 2 why this change? > """ > self.assertEqual(expected.lstrip(), contents.lstrip()) > self.assertEqual(1, mock_clean_default.call_count) -- https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master has been updated. Commit message changed to: azure/net: generate_fallback_config emits network config v2 To enable Azure to send network v2, net.generate_fallback_config now generates network config v2 instead of v1. To support this shift, network_state also needed a small addition to account for setting driver params if present in the match section for a specific interface. For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 -- Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
Diff comments: > diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py > index f3cec79..fa15b96 100644 > --- a/cloudinit/net/__init__.py > +++ b/cloudinit/net/__init__.py > @@ -272,25 +273,30 @@ def generate_fallback_config(blacklist_drivers=None, > config_driver=None): > config_driver = False > > target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers) > -if target_name: > -target_mac = read_sys_net_safe(target_name, 'address') > +if not target_name: > +# can't read any interfaces addresses (or there are none); give up > +return None > +target_mac = read_sys_net_safe(target_name, 'address') > +driver_params = {} > +if config_driver: > +driver = device_driver(target_name) > +if driver: > +driver_params = {'driver': driver, > + 'device_id': device_devid(target_name)} > +if network_version == 1: > +# TODO(Drop network v1 once NetworkState parses v2) You are correct here, I misinterpreted a test failure I ran into with network_state not handling v2 match:driver declarations when emitting udev rules. Got that fixed in the followup. > nconf = {'config': [], 'version': 1} > cfg = {'type': 'physical', 'name': target_name, > 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]} > -# inject the device driver name, dev_id into config if enabled and > -# device has a valid device driver value > -if config_driver: > -driver = device_driver(target_name) > -if driver: > -cfg['params'] = { > -'driver': driver, > -'device_id': device_devid(target_name), > -} > +if driver_params: > +cfg['params'] = driver_params > nconf['config'].append(cfg) > return nconf > -else: > -# can't read any interfaces addresses (or there are none); give up > -return None > +cfg = {'dhcp4': True, 'set-name': target_name, > + 'match': {'macaddress': target_mac.lower()}} > +cfg['match'].update(driver_params) > +nconf = {'ethernets': {target_name: cfg}, 'version': 2} > +return nconf > > > def extract_physdevs(netcfg): -- https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master has been updated. Commit message changed to: azure/net: generate_fallback_nic emits network v2 config instead of v1 To enable Azure to send network v2, net.generate_fallback_config now generates network config v2 instead of v1. To support this shift, network_state also needed a small addition to account for setting driver params if present in the match section for a specific interface. For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 -- Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master has been updated. Commit message changed to: azure/net: generate_fallback_nic emits network v2 config instead of v1 The function generate_fallback_config is used by Azure by default when not consuming IMDS configuration data. This function is also used by any datasource which does not implement it's own network config. This simple fallback configuration sets up dhcp on the most likely NIC. It will now emit network v2 instead of network v1. This is a step toward moving all components talking in v2 and allows us to avoid costly conversions between v1 and v2 for newer distributions which rely on netplan. For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 -- Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master
One question, otherwise happy to see the doc update. Diff comments: > diff --git a/cloudinit/config/cc_set_passwords.py > b/cloudinit/config/cc_set_passwords.py > index 4585e4d..10d68ea 100755 > --- a/cloudinit/config/cc_set_passwords.py > +++ b/cloudinit/config/cc_set_passwords.py > @@ -9,27 +9,38 @@ > """ > Set Passwords > - > -**Summary:** Set user passwords > - > -Set system passwords and enable or disable ssh password authentication. > -The ``chpasswd`` config key accepts a dictionary containing a single one of > two > -keys, either ``expire`` or ``list``. If ``expire`` is specified and is set to > -``false``, then the ``password`` global config key is used as the password > for > -all user accounts. If the ``expire`` key is specified and is set to ``true`` > -then user passwords will be expired, preventing the default system passwords > -from being used. > - > -If the ``list`` key is provided, a list of > -``username:password`` pairs can be specified. The usernames specified > -must already exist on the system, or have been created using the > -``cc_users_groups`` module. A password can be randomly generated using > -``username:RANDOM`` or ``username:R``. A hashed password can be specified > -using ``username:$6$salt$hash``. Password ssh authentication can be > -enabled, disabled, or left to system defaults using ``ssh_pwauth``. > +**Summary:** Set user passwords and enable/disable SSH password > authentication > + > +This module consumes three top-level config keys: ``ssh_pwauth``, > ``chpasswd`` > +and ``password``. > + > +The ``ssh_pwauth`` config key determines whether or not sshd will be > configured > +to accept password authentication. True values will enable password auth, > +false values will disable password auth, and the literal string ``unchanged`` > +will leave it unchanged. Setting no value will also leave the current > setting > +on-disk unchanged. > + > +The ``chpasswd`` config key accepts a dictionary containing either or both of > +``expire`` and ``list``. > + > +If the ``list`` key is provided, it should contain a list of > +``username:password`` pairs. This can be either a YAML list (of strings), > or a > +multi-line string with one pair per line. Each user will have the > +corresponding password set. A password can be randomly generated by > specifying > +``RANDOM`` or ``R`` as a user's password. A hashed password can be specified > +using ``$6$salt$hash`` as a user's password. Should we mention tools that generate hashed passwords? I worry that someone will send password: $6$salt$hash Also, should we mention the regular expression used to detect hashed passwords? prog = re.compile(r'\$(1|2a|2y|5|6)(\$.+){2}') > > .. note:: > -if using ``expire: true`` then a ssh authkey should be specified or it > may > -not be possible to login to the system > +The users specified must already exist on the system. Users will have > been > +created by the ``cc_users_groups`` module at this point. > + > +By default, all users on the system will have their passwords expired > (meaning > +that they will have to be reset the next time the user logs in). To disable > +this behaviour, set ``expire`` under ``chpasswd`` to a false value. > + > +If a ``list`` of user/password pairs is not specified under ``chpasswd``, > then > +the value of the ``password`` config key will be used to set the default > user's > +password. > > **Internal name:** ``cc_set_passwords`` > -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/370927 Your team cloud-init commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:doc into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master
One inline question. Diff comments: > diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py > index f3cec79..fa15b96 100644 > --- a/cloudinit/net/__init__.py > +++ b/cloudinit/net/__init__.py > @@ -272,25 +273,30 @@ def generate_fallback_config(blacklist_drivers=None, > config_driver=None): > config_driver = False > > target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers) > -if target_name: > -target_mac = read_sys_net_safe(target_name, 'address') > +if not target_name: > +# can't read any interfaces addresses (or there are none); give up > +return None > +target_mac = read_sys_net_safe(target_name, 'address') > +driver_params = {} > +if config_driver: > +driver = device_driver(target_name) > +if driver: > +driver_params = {'driver': driver, > + 'device_id': device_devid(target_name)} > +if network_version == 1: > +# TODO(Drop network v1 once NetworkState parses v2) This is confusing to me. NetworkState definitely can parse v2? The NetworkStateInterpreter:parse_config_v2 ? > nconf = {'config': [], 'version': 1} > cfg = {'type': 'physical', 'name': target_name, > 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]} > -# inject the device driver name, dev_id into config if enabled and > -# device has a valid device driver value > -if config_driver: > -driver = device_driver(target_name) > -if driver: > -cfg['params'] = { > -'driver': driver, > -'device_id': device_devid(target_name), > -} > +if driver_params: > +cfg['params'] = driver_params > nconf['config'].append(cfg) > return nconf > -else: > -# can't read any interfaces addresses (or there are none); give up > -return None > +cfg = {'dhcp4': True, 'set-name': target_name, > + 'match': {'macaddress': target_mac.lower()}} > +cfg['match'].update(driver_params) > +nconf = {'ethernets': {target_name: cfg}, 'version': 2} > +return nconf > > > def extract_physdevs(netcfg): -- https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970 Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp