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

Add 'ipa local-env' subcommand #247

Closed
wants to merge 1 commit into from
Closed

Conversation

tiran
Copy link
Member

@tiran tiran commented Nov 16, 2016

ipa local-env simply dumps all values from api.env as sorted key="value"
pairs. It's a convenient helper for debugging and to write tests for
e.g. PR #182.

https://fedorahosted.org/freeipa/ticket/6490

Signed-off-by: Christian Heimes cheimes@redhat.com

@martbab
Copy link
Contributor

martbab commented Nov 16, 2016

Maybe I am missing something, but we have ipa env command for a long time that does exactly the same thing:

# ipa env
  api_version: 2.216
  basedn: dc=ipa,dc=test
  bin: /
  ca_agent_install_port: None
  ca_agent_port: 443
  ca_ee_install_port: None
  ca_ee_port: 443
  ca_host: master1.ipa.test
  ca_install_port: None
  ca_port: 80
  conf: /etc/ipa/server.conf
  conf_default: /etc/ipa/default.conf
  confdir: /etc/ipa
  config_loaded: True
  container_accounts: cn=accounts
  container_adtrusts: cn=ad,cn=trusts
  container_applications: cn=applications,cn=configs,cn=policies
  container_automember: cn=automember,cn=etc
  container_automount: cn=automount
  container_ca: cn=cas,cn=ca
  container_caacl: cn=caacls,cn=ca
  container_certprofile: cn=certprofiles,cn=ca
  container_cifsdomains: cn=ad,cn=etc
  container_configs: cn=configs,cn=policies
  container_custodia: cn=custodia,cn=ipa,cn=etc
  container_deleteuser: cn=deleted users,cn=accounts,cn=provisioning
  container_dna: cn=dna,cn=ipa,cn=etc
  container_dna_posix_ids: cn=posix-ids,cn=dna,cn=ipa,cn=etc
  container_dns: cn=dns
<SNIP>

@tiran
Copy link
Member Author

tiran commented Nov 16, 2016

ipa env gets env vars from the server. ipa show_env gets only local settings. For example ipa env prints the LDAPI unix socket address for ldap_uri. Once the API schema bug is fixed, show_env won't even need a running server. show_env also prints the settings in a shell source compatible way.

$ ./ipa env | grep site_packages
  site_packages: /usr/lib/python2.7/site-packages
$ ./ipa env | grep ldap_uri
  ldap_uri: ldapi://%2fvar%2frun%2fslapd...
$ ./ipa show_env | grep site_packages
site_packages="/home/heimes/redhat/freeipa"

@MartinBasti
Copy link
Contributor

So then it should be called local-env to be clear what does it do

ipa local-env simply dumps all values from api.env as sorted key="value"
pairs. It's a convenient helper for debugging and to write tests for
e.g. PR freeipa#182.

https://fedorahosted.org/freeipa/ticket/6490

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran changed the title Add 'ipa show_env' subcommand Add 'ipa local-env' subcommand Nov 16, 2016
@tiran
Copy link
Member Author

tiran commented Nov 16, 2016

Good point! I changed the name to local-env.

@MartinBasti
Copy link
Contributor

You have PEP8 error there

./ipalib/cli.py:57:1: E402 module level import not at top of file

@MartinBasti MartinBasti self-assigned this Nov 16, 2016
@tiran
Copy link
Member Author

tiran commented Nov 16, 2016

The PEP8 error can't be fixed. The evil reload(sys) hack must come before the remaining imports of ipalib and ipapython.

@martbab martbab added ack Pull Request approved, can be merged pushed Pull Request has already been pushed labels Nov 18, 2016
@martbab
Copy link
Contributor

martbab commented Nov 18, 2016

@martbab martbab closed this Nov 18, 2016
@HonzaCholasta
Copy link
Contributor

Sorry, but this is wrong. ipa env is supposed to return local settings unless run with --server. Why was it not fixed instead of adding a new redundant command?

@tiran
Copy link
Member Author

tiran commented Nov 21, 2016

@jcholast Please open a ticket.

@tiran tiran deleted the ipa_show_env branch November 21, 2016 08:56
@HonzaCholasta
Copy link
Contributor

Reopened 6490.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
4 participants