Commit fd5f808b authored by Nicolas Wavrant's avatar Nicolas Wavrant

slapconfiguration: returns also slapuser

parent 58e4f80e
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
import json import json
import os import os
import pwd
import slapos.slap import slapos.slap
from slapos.recipe.librecipe import unwrap from slapos.recipe.librecipe import unwrap
...@@ -105,6 +106,8 @@ class Recipe(object): ...@@ -105,6 +106,8 @@ class Recipe(object):
anyway, and are available through "configuration" output key. anyway, and are available through "configuration" output key.
instance-state instance-state
The instance state. The instance state.
slapuser
The username associated to the slappart.
""" """
# XXX: used to detect if a configuration key is a valid section key. This # XXX: used to detect if a configuration key is a valid section key. This
...@@ -122,6 +125,8 @@ class Recipe(object): ...@@ -122,6 +125,8 @@ class Recipe(object):
options['configuration.' + key] = value options['configuration.' + key] = value
def fetch_parameter_dict(self, options, instance_root): def fetch_parameter_dict(self, options, instance_root):
options['slapuser'] = str(pwd.getpwuid(os.getuid()).pw_name)
slap = slapos.slap.slap() slap = slapos.slap.slap()
slap.initializeConnection( slap.initializeConnection(
options['url'], options['url'],
......
  • Why not use the userinfo recipe ?

  • Hello,

    Simply because it was unknown to me and people to whom I talked about my need... First I wanted to create a new recipe, called something like "extra-partition-information", but I was told not to multiply the recipes.

    Research Skill : 0. I'm gonna fix it.

  • mentioned in commit 73d73b52

    Toggle commit list
  • fixed in e9f3b2c5

  • Thanks, please also revert this commit, just to avoid information/implementation duplication.

    Re-reading the doc of this recipe, I realise the intent may not be clear: the intent is not to contain all parameters of the partition (at least, that's not the intent I had when I implemented this recipe).

    The intent was to just allow accessing whatever the master would make available to this partition as part of its "parameters".

    I think it is not nice that the master is what gives us the IP list, which really belong to the partition: master should never need to even know these addresses to begin with. IPs should be provided locally by slapos commands, and never leave the computer. Likewise for all these tap* values. Then, they would not belong anymore to this recipe either, which would be left with basically:

    • slap-software-type
    • instance-state
    • configuration (and configuration.* for easier transition from xml to json-in-xml and someday hopefully bare json)
    • root-instance-title and instance-title (didn't know/remember these existed, but they do belong to what the master know and can tell us about ourselves)
  • (and I just realised you already did revert this commit... sorry for the noise)

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