Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Conversation

@intlabs
Copy link
Contributor

@intlabs intlabs commented Mar 16, 2017

What is the purpose of this pull request?: To replace ansible with PyMySQL for DB Creation

What issue does this pull request address?: Superceeds #206, which in turn superseded #140.

Notes for reviewers to consider:
This PR will limit its scope to helm-toolkit and keystone until we have resolved the path ahead, once consensus is reached it will be expanded to the remaining services.

Specific reviewers for pull request:
@alanmeadows @v1k0d3n

@intlabs intlabs changed the title wip: Update toolkit functions to include DB Endpoint lookups wip: replace ansible with PyMySQL for DB Creation Mar 16, 2017
@v1k0d3n
Copy link
Collaborator

v1k0d3n commented Mar 17, 2017

you'll have to let me know when you want this reviewed. i was just about to pull in the other work from #206, and found you sprawled into this new PR.

@intlabs
Copy link
Contributor Author

intlabs commented Mar 17, 2017

@v1k0d3n np, I'll remove the wip when it's ready :)

The PR's in #206 are still needed for this to be functional:

A new PR was created as after 1 month it's simply not feasible to rebase :/

@v1k0d3n v1k0d3n changed the title wip: replace ansible with PyMySQL for DB Creation feat: replace ansible with PyMySQL for DB Creation Mar 18, 2017
@v1k0d3n v1k0d3n changed the title feat: replace ansible with PyMySQL for DB Creation wip: replace ansible with PyMySQL for DB Creation Mar 18, 2017
@intlabs intlabs changed the title wip: replace ansible with PyMySQL for DB Creation feat: replace ansible with PyMySQL for DB Creation (do not merge) Mar 22, 2017
@intlabs
Copy link
Contributor Author

intlabs commented Mar 22, 2017

@alanmeadows, @v1k0d3n if you could have a look at this, its ready for initial review. Once we've got this looking sweet I'll expand the concept out to all the other charts.

@v1k0d3n v1k0d3n added this to the 0.3.0 milestone Mar 22, 2017
@v1k0d3n v1k0d3n requested review from alanmeadows and v1k0d3n March 22, 2017 19:02
@intlabs intlabs changed the title feat: replace ansible with PyMySQL for DB Creation (do not merge) feat: replace ansible with PyMySQL for DB Creation (do not merge - ready for review) Mar 29, 2017
Copy link
Contributor

@wilkers-steve wilkers-steve left a comment

Choose a reason for hiding this comment

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

Unless I'm missing something, this looks good to me @intlabs. I'm definitely looking forward to this change getting merged in and expanding the work to the other charts.

Copy link
Contributor

@alanmeadows alanmeadows left a comment

Choose a reason for hiding this comment

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

Looks good @intlabs. A few comments, nothing major.

# See the License for the specific language governing permissions and
# limitations under the License.

{{- define "helm-toolkit.db_init" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I still recommend we adopt full paths (even though I am sometimes not following my own advice), to locate where these methods are physically located:

define "helm-toolkit.scripts.db_init"

Also, we can probably do better then scripts, perhaps keystone foo, db foo, and so on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this sentiment, can we hit this in a separate PR though, so as to minimise disruption to work in flight?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @alanmeadows here, I think it would be best to add a bit more detail to the path within helm-toolkit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree w/ @intlabs that this needs to be in another PR. and documented in an issue.

print("Created database {0}".format(database))
except:
print("Could not create database {0}".format(database))
sys.exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose you do not want to involve the standard logger for simplicity reasons (which could use LOG.traceback(foo) but this exception will lack a traceback that may include some hint at why if one should ever need it.

There is a balance between overloading the user and providing them curt errors but I'd appreciate a traceback if an action like this fails as sqlalchemy may provide some hint from the engine as to what went wrong.

Alternative to logger could be if your really trying to be print-locked:

import traceback
print traceback.format_exc()

Copy link
Contributor Author

@intlabs intlabs Apr 3, 2017

Choose a reason for hiding this comment

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

no reason to be bound to print. It was just the quickest and simplest way to implement this. I'm fine using the standard logger, or adding tracebacks.

database, user, password))
print("Created user {0} for {1}".format(user, database))
except:
print("Could not create user {0} for {1}".format(user, database))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, re: traceback.

print 'Database connection for user ok'
except:
print 'Could not connect to database as user'
sys.exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, re: traceback.

secretKeyRef:
name: keystone-db-root
key: DB_CONNECTION
- name: OPENSTACK_CONFIG_FILE
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this approach. No need to pass data to this thing thats already in the config.

print("Trying to load db config from {0}:{1}".format(
os_conf_section, os_conf_key))
user_db_conn = config.get(os_conf_section, os_conf_key)
print("Got config from {0}".format(os_conf))
Copy link
Contributor

@alanmeadows alanmeadows Mar 31, 2017

Choose a reason for hiding this comment

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

For debugging do we perhaps want to print what we're working with (the final resulting db connect string) or do we feel security would be compromised?

Copy link
Contributor

Choose a reason for hiding this comment

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

Plus @v1k0d3n for thoughts on stdout containing sensitive usernames and passwords. Helps debugging. Hurts security.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alanmeadows I'd be very hesitant to do that as a result of the security concerns you highlight. Printing passwords to stdout seems like a recipe for having a bad time to me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we're getting down to it, we're already sending passwords/secrets in the clear today (via configmaps, and then sending them on to tiller).

i think we should fix the security issues we have soon, and start planning for proper secrets management (it's on the roadmap), but i also think we should include a helpful debug mechanism like @alanmeadows is suggesting. otherwise it just gets too magical for the average user starting to work with openstack-helm.

hopefully with a proper combination of the two, we'll give users/developers confidence that when they use debugging in OSH, passwords/secrets are only being passed at their command, which would make @intlabs and me much more happy.

intlabs added 9 commits April 4, 2017 11:33
I am removing my copywrite and transfering it to the OpenStack-Helm Authors
for the DB Managment Script. As although this was primarily written while an
independant OSS Developer, it is not currently present in any other codebase
and will only be merged post commencing work on the project in an official
capacity. This does not affect the copywrite of any other code contibuted to
the project by myself or any other party.
@intlabs intlabs changed the title feat: replace ansible with PyMySQL for DB Creation (do not merge - ready for review) feat: replace ansible with PyMySQL for DB Creation Apr 4, 2017
@intlabs intlabs requested a review from larryrensing April 4, 2017 20:23
Copy link
Contributor

@larryrensing larryrensing left a comment

Choose a reason for hiding this comment

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

This looks great @intlabs, nice work.

# See the License for the specific language governing permissions and
# limitations under the License.

{{- define "helm-toolkit.db_init" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @alanmeadows here, I think it would be best to add a bit more detail to the path within helm-toolkit.

Copy link
Contributor

@wilkers-steve wilkers-steve left a comment

Choose a reason for hiding this comment

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

@intlabs This looks good to me. I'm leaning towards @alanmeadows and @larryrensing suggestions that we work with the paths a bit, but that should be handled separately. I don't see a reason for that to block getting this in finally.

@wilkers-steve wilkers-steve merged commit d0a9bd2 into att-comdev:master Apr 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants