Giter Club home page Giter Club logo

cfme-rhconsulting-scripts's Introduction

Cloudforms/ManageIQ rhconsulting rake scripts

These scripts are useful to import/export specific items

Note: be sure that there are no other tasks in lib/tasks with the same task name. Rake ignores the namespace (rhconsulting in this case) and uses the task method name. This can cause issues if you have two rake files with the same task names. For example, make sure there are not two instances of the dialogs:export. Even if you specify the namespace rake might choose the wrong task to run

Important
Exporting and importing of widgets requires CloudForms 4.1 or ManageIQ Darga or greater releases.

Install

Option 1) use make commands

  • Get latest files from github

rm -fR cfme-rhconsulting-scripts/
git clone https://github.com/rhtconsulting/cfme-rhconsulting-scripts.git
  • Install files to /var/www/miq/vmdb/lib/tasks

cd cfme-rhconsulting-scripts/
make install
  • Clean install (Removes the files before installing)

cd cfme-rhconsulting-scripts/
make clean-install

Option 2) Copy files manually * Copy the .rake files to /var/www/miq/vmdb/lib/tasks

cd cfme-rhconsulting-scripts/
cp *.rake /var/www/miq/vmdb/lib/tasks/

Export command

Usage: miqexport <object_type> <additional_params> <exportdest>

This command exports the specified object type into the <exportdest>,
which may be a file or directory.

<additional_params> may be required depending on the type of object to be
exported.

Available Object Types:
  provision_dialogs                Export provisioning dialogs.
  service_dialogs                  Export service dialogs.
  service_catalogs                 Export service catalogs.
  roles                            Export user roles.
  tags                             Export tags.
  buttons                          Export buttons.
  customization_templates          Export customization templates.
  reports                          Export custom reports.
  widgets                          Export custom widgets.
  alerts                           Export alerts.
  alertsets                        Export alert sets.
  policies                         Export policies.
  domain <name>                    Export the specified domain from the
                                   Automate Engine Datastore. <name> MUST
                                   be specified.

Options:
  -s, --keep-spaces                Export filenames with spaces instead of
                                   replacing the spaces with underscores.
                                   (this preserves old behavior)

Note: As of version 0.9 spaces in exported filenames are be replaced with underscores. To preserve the old behavior and keep spaces in the filenames pass in -s or --keep-spaces to the miqexport script.

Example exports

# export the 'MyCustomDomain' to /tmp, i.e., /tmp/MyCustomDomain
miqexport domain MyCustomDomain /tmp

# export service dialogs to /tmp/dialogs
miqexport service_dialogs /tmp/dialogs

Import Command

Usage: miqimport <object_type> <additional_params> <importsource>

This command imports the specified object type from the <importsource>,
which may be a file or directory.

<additional_params> may be required depending on the type of object to be
imported.

Available Object Types:
  provision_dialogs                Import provisioning dialogs.
  service_dialogs                  Import service dialogs.
  service_catalogs                 Import service catalogs.
  roles                            Import user roles.
  tags                             Import tags.
  buttons                          Import buttons.
  customization_templates          Import customization templates.
  reports                          Import custom reports.
  widgets                          Import custom widgets.
  alerts                           Import alerts.
  alertsets                        Import alert sets.
  policies                         Import policies.
  domain <name>                    Import the specified domain from the
                                   <importsource> directory. <name> MUST
                                   be specified.

Example Imports

# import 'MyCustomDomain' from /tmp, i.e., /tmp/MyCustomDomain
miqimport domain MyCustomDomain /tmp

# import service dialogs from /tmp/dialogs
miqimport service_dialogs /tmp/dialogs

Export examples using rake

  • You can do the export by using the export-miqdomain script or manually as well.

export-domain
Usage: ./export-domain -d CloudFormsDomain -D /path/to/the/directory

OPTIONS:
  -d    CloudForms Domain
  -D    Path to the directory
  -h    Displays help
  • To do the export manually, follow the below steps.

BUILDDIR=/tmp/CFME-build
DOMAIN_EXPORT=YourDomainHere

rm -fR ${BUILDDIR}
mkdir -p ${BUILDDIR}/{service_catalogs,dialogs,roles,tags,buttons,customization_templates,policies,alerts,alertsets,widgets,miq_ae_datastore}

cd /var/www/miq/vmdb
bin/rake rhconsulting:provision_dialogs:export[${BUILDDIR}/provision_dialogs]
bin/rake rhconsulting:service_dialogs:export[${BUILDDIR}/service_dialogs]
bin/rake rhconsulting:service_catalogs:export[${BUILDDIR}/service_catalogs]
bin/rake rhconsulting:roles:export[${BUILDDIR}/roles/roles.yml]
bin/rake rhconsulting:tags:export[${BUILDDIR}/tags/tags.yml]
bin/rake rhconsulting:buttons:export[${BUILDDIR}/buttons/buttons.yml]
bin/rake rhconsulting:customization_templates:export[${BUILDDIR}/customization_templates/customization_templates.yml]
bin/rake rhconsulting:miq_policies:export[${BUILDDIR}/policies]
bin/rake rhconsulting:miq_alerts:export[${BUILDDIR}/alerts]
bin/rake rhconsulting:miq_alertsets:export[${BUILDDIR}/alertsets]
bin/rake rhconsulting:miq_widgets:export[${BUILDDIR}/widgets]
bin/rake "rhconsulting:miq_ae_datastore:export[${DOMAIN_EXPORT}, ${BUILDDIR}/miq_ae_datastore]"

Import examples using rake

  • You can do the import by using the import-miqdomain script or manually as well.

import-miqdomain
Usage: ./import-miqdomain -D /absolute/path/to/the/directory

OPTIONS:
  -D    Path to the directory
  -h    Displays help
  • To do the import manually, follow the below steps.

BUILDDIR=/tmp/CFME-build
DOMAIN_IMPORT=YourDomainHere

cd /var/www/miq/vmdb
bin/rake rhconsulting:provision_dialogs:import[${BUILDDIR}/provision_dialogs]
bin/rake rhconsulting:service_dialogs:import[${BUILDDIR}/service_dialogs]
bin/rake rhconsulting:roles:import[${BUILDDIR}/roles/roles.yml]
bin/rake rhconsulting:tags:import[${BUILDDIR}/tags/tags.yml]
bin/rake rhconsulting:buttons:import[${BUILDDIR}/buttons/buttons.yml]
bin/rake rhconsulting:customization_templates:import[${BUILDDIR}/customization_templates/customization_templates.yml]
bin/rake rhconsulting:miq_policies:import[${BUILDDIR}/policies]
bin/rake rhconsulting:miq_alerts:import[${BUILDDIR}/alerts]
bin/rake rhconsulting:miq_alertsets:import[${BUILDDIR}/alertsets]
bin/rake rhconsulting:miq_widgets:import[${BUILDDIR}/widgets]
bin/rake rhconsulting:service_catalogs:import[${BUILDDIR}/service_catalogs]
bin/rake "rhconsulting:miq_ae_datastore:import[${DOMAIN_IMPORT}, ${BUILDDIR}/miq_ae_datastore]"
bin/rake rhconsulting:service_catalogs:import[${BUILDDIR}/service_catalogs]
Note
Service Catalogs should be imported last as they reference Dialogs and the Automate Domain(s).

Contribution guidelines

  • Writing tests

  • Code review

  • Other guidelines

Who do I talk to?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.