Commit 5fb78e4c authored by Xavier Thompson's avatar Xavier Thompson

slapconfiguration: Enable <= slap-connection

Introduce alternative names for input parameters to enable

```
[slap-configuration]
<= slap-connection
recipe = slapos.cookbook:slapconfiguration
```

instead of

```
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
```
parent e1e4ed3f
...@@ -52,21 +52,21 @@ class Recipe(object): ...@@ -52,21 +52,21 @@ class Recipe(object):
For example {"tun": {"ipv4": <addr>}} would be available in buildout as ${instance:tun-ipv4}. For example {"tun": {"ipv4": <addr>}} would be available in buildout as ${instance:tun-ipv4}.
Input: Input:
url url | server-url
Slap server url. Slap server url.
Example: Example:
${slap-connection:server-url} ${slap-connection:server-url}
key & cert (optional) key & cert | key-file & cert-file (optional)
Path of files containing key and certificate for secure connection to Path of files containing key and certificate for secure connection to
slap server. slap server.
Example: Example:
${slap-connection:key-file} ${slap-connection:key-file}
${slap-connection:cert-file} ${slap-connection:cert-file}
computer computer | computer-id
Computer identifier. Computer identifier.
Example: Example:
${slap-connection:computer-id} ${slap-connection:computer-id}
partition partition | partition-id
Partition identifier. Partition identifier.
Example: Example:
${slap-connection:partition-id} ${slap-connection:partition-id}
...@@ -129,14 +129,16 @@ class Recipe(object): ...@@ -129,14 +129,16 @@ class Recipe(object):
2. format.Partition.resource_file - for partition specific details 2. format.Partition.resource_file - for partition specific details
""" """
slap = slapos.slap.slap() slap = slapos.slap.slap()
# BBB: or ... (right side) clauses kept for compatibility;
# left-side clauses correspond directly to slap-connection.
slap.initializeConnection( slap.initializeConnection(
options['url'], options.get('server-url') or options['url'],
options.get('key'), options.get('key-file') or options.get('key'),
options.get('cert'), options.get('cert-file') or options.get('cert'),
) )
computer_partition = slap.registerComputerPartition( computer_partition = slap.registerComputerPartition(
options['computer'], options.get('computer-id') or options['computer'],
options['partition'], options.get('partition-id') or options['partition'],
) )
parameter_dict = computer_partition.getInstanceParameterDict() parameter_dict = computer_partition.getInstanceParameterDict()
options['instance-state'] = computer_partition.getState() options['instance-state'] = computer_partition.getState()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment