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

Accept configdrive info as {path: base64_content} style #23

Merged
merged 12 commits into from
Jan 22, 2014

Conversation

jimrollenhagen
Copy link
Contributor

Discussed with Chris in IRC this morning and decided this was the best way to go.

This also hardcodes the location on disk to write the configdrive to. I don't think that needs to be parameterized.

filename = os.path.join(location, path)
with open(filename, 'w') as f:
json_data = contents.decode('base64')
f.write(json_data)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily json data anymore, but :)

@russellhaering
Copy link
Contributor

Yeah, I think this is fine, +1

@russellhaering
Copy link
Contributor

@pquerna thoughts on this? We had some back-and-forth last week, and I saw you mention this on IRC over the weekend.

  1. I believe that the teeth-overlord API should resemble Nova's, in that it should allow a user to inject files onto the host filesystem, but shouldn't expose them to the details of configdrive/cloud-init/whatever-else-might-appear-in-the-future.
  2. Between the overlord and the agent I'm less opinionated about the API. One option (implemented here) is that the agent is relatively "dumb" and the overlord gives it files to put into configdrive. Another option would be for this to more closely resemble the public API - taking some files and some metadata, and generating the appropriate configdrive layout itself.

I hate base64 as an API as much as the next person, but given that this isn't user-facing, and that we're going to be taking some base64 blobs, I'm alright with this.

f.write(json_metadata)


def write_configdrive(location, metadata, files, prefix='teeth',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function actually used outside of tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this prefix (and maybe the one above) should default to openstack. I don't see writing to a teeth prefix being practical in the near future.

@russellhaering
Copy link
Contributor

Other than the "teeth" prefix, LGTM.

@jimrollenhagen jimrollenhagen merged commit f11e272 into master Jan 22, 2014
@jimrollenhagen jimrollenhagen deleted the base64-configdrive branch January 22, 2014 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants