Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use File source without registry. #15

Closed
allomov opened this issue Apr 24, 2015 · 5 comments

Comments

@allomov
Copy link
Contributor

commented Apr 24, 2015

You can set the agent to read settings from file using following config options:

{
  ...
  "Infrastructure": {
    "Settings": {
      "Sources": [
        {
          "Type": "File",
          "MetaDataPath": "/home/vcap/metadata",
          "UserDataPath": "/home/vcap/userdata",
          "SettingsPath": "/home/vcap/settings"
        }
      ]
    }
  }
}

Without UseRegistry option you'll get this error: File source is not supported without registry.

Could you tell if there is any actual reason to restrict to read settings from file if you don't use registry?

@bosh-ci-push-pull

This comment has been minimized.

Copy link
Collaborator

commented Apr 24, 2015

Not technical reason, we just have not implemented that in bosh-agent:
https://github.com/cloudfoundry/bosh-agent/blob/master/infrastructure/settings_source_factory.go#L156

Our plan is to actually remove registry completely so at some point we will
implement this option.

On Fri, Apr 24, 2015 at 2:16 PM, Alexander Lomov notifications@github.com
wrote:

You can set the agent to read settings from file using following config
options:

{
...
"Infrastructure": {
"Settings": {
"Sources": [
{
"Type": "File",
"MetaDataPath": "/home/vcap/metadata",
"UserDataPath": "/home/vcap/userdata",
"SettingsPath": "/home/vcap/settings"
}
]
}
}
}

Without UseRegistry option you'll get this error
https://github.com/cloudfoundry/bosh-agent/blob/master/infrastructure/settings_source_factory.go#L156:
File source is not supported without registry.

Could you tell if there is any actual reason to restrict to read settings
from file if you don't use registry?


Reply to this email directly or view it on GitHub
#15.

@allomov

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2015

May I create PR for this?

@mariash

This comment has been minimized.

Copy link
Member

commented Apr 26, 2015

Hi @allomov,

If you want to inject the file with settings you can use the file based registry. The settings source in agent.json represents the metadata source, which in case of file is file based metadata/userdata source. This is to be consistent with other source types.

{
  ...
  "Infrastructure": {
    "Settings": {
      "Sources": [
        {
          "Type": "File",
          "MetaDataPath": "/home/vcap/metadata",
          "UserDataPath": "/home/vcap/userdata"
        }
      ]
    }
  }
}

In your userdata file just set registry endpoint to the file path.

{
  "server": {
    "name": "instance-id"
  },
  "registry": {
    "endpoint": "/home/vcap/settings.json"
  }
}
@allomov

This comment has been minimized.

Copy link
Contributor Author

commented Apr 26, 2015

Thank you, @mariash, for answer. It may help.

But don't you think that having SettingsPath option in file source settings can cause a confusion? Could you add more details about consistency with other source types?

Because from my view, it is easier to use SettingsPath option to read settings from file, rather than passing registry endpoint through userdata to read the settings from the same file. Another point for using SettingsPath in file source without registry is that registry is going to be deprecated. I guess this changes should be made sometime. What do you think?

@cppforlife

This comment has been minimized.

Copy link
Member

commented Apr 27, 2015

@allomov We'll take a PR for making FileSettingsSource without registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.