Skip to content

Commit 8ae3b07

Browse files
committed
[squashme] howto pyhon enum plz?
1 parent 82442d8 commit 8ae3b07

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

include/netplan.h

-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ netplan_netdef_get_vlan_link(const NetplanNetDefinition* netdef);
118118
NETPLAN_PUBLIC NetplanNetDefinition*
119119
netplan_netdef_get_sriov_link(const NetplanNetDefinition* netdef);
120120

121-
NETPLAN_PUBLIC char *
122-
netplan_netdef_get_keep_configuration(const NetplanNetDefinition* netdef);
123-
124121
NETPLAN_PUBLIC ssize_t
125122
netplan_netdef_get_set_name(const NetplanNetDefinition* netdef, char* out_buffer, size_t out_buffer_size);
126123

python-cffi/netplan/_build_cffi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
typedef struct netplan_net_definition NetplanNetDefinition;
3535
typedef enum { ... } NetplanBackend;
3636
typedef enum { ... } NetplanDefType;
37+
typedef enum { ... } NetplanCriticalOption;
3738
3839
// TODO: Introduce getters for .address/.lifetime/.label to avoid exposing the raw struct
3940
typedef struct {
@@ -112,7 +113,7 @@
112113
ssize_t _netplan_netdef_get_embedded_switch_mode(const NetplanNetDefinition* netdef, char* out_buffer, size_t out_buf_size);
113114
gboolean _netplan_netdef_get_sriov_vlan_filter(const NetplanNetDefinition* netdef);
114115
guint _netplan_netdef_get_vlan_id(const NetplanNetDefinition* netdef);
115-
char* netplan_netdef_get_keep_configuration(const NetplanNetDefinition* netdef);
116+
NetplanCriticalOption _netplan_netdef_get_critical(const NetplanNetDefinition* netdef);
116117
gboolean _netplan_netdef_is_trivial_compound_itf(const NetplanNetDefinition* netdef);
117118
int _netplan_state_get_vf_count_for_def(
118119
const NetplanState* np_state, const NetplanNetDefinition* netdef, NetplanError** error);

python-cffi/netplan/netdef.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def set_name(self) -> str:
7575
return _string_realloc_call_no_error(lambda b: lib.netplan_netdef_get_set_name(self._ptr, b, len(b)))
7676

7777
@property
78-
def keep_configuration(self) -> str:
79-
return _string_realloc_call_no_error(lambda b: lib.netplan_netdef_get_keep_configuration(self._ptr, b, len(b)))
78+
def critical(self) -> bool:
79+
return bool(lib._netplan_netdef_get_critical(self._ptr))
8080

8181
@property
8282
def links(self) -> dict:

0 commit comments

Comments
 (0)