Skip to content

rhtconsulting/cfme-rhconsulting-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudforms/ManageIQ rhconsulting rake scripts

These scripts are useful to import/export specific items.

Obtaining Support

These scripts are community supported and not supported by Red Hat Support. For any problems open a GitHub issue to request help or use the export/import features that are included with CloudForms.

Information

Important

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

Note

These scripts are being migrated to be included with ManageIQ.

ManageIQ Tracking Issue: ManageIQ/manageiq#15350

Scripts in this repo that are now depricated:

  • rhconsulting_alerts.rake

  • rhconsulting_buttons.rake

  • rhconsulting_customization_templates.rake

  • rhconsulting_policies.rake

  • rhconsulting_provision_dialogs.rake

  • rhconsulting_service_dialogs.rake

  • rhconsutling_tags.rake

  • rhconsulting_roles.rake

  • rhconsulting_reports.rake

  • rhconsulting_widgets.rake

  • rhconsulting_scanitems.rake

Ensure 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

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 and *.rb files to /var/www/miq/vmdb/lib/tasks

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

Export command

Usage: miqexport [OPTION...] <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.
  orchestration_templates          Export orchestration templates.
  reports                          Export custom reports.
  widgets                          Export custom widgets.
  alerts                           Export alerts.
  alertsets                        Export alert sets.
  policies                         Export policies.
  scanitems                        Export scan items.
  scriptsrc                        Export config script sources.
  schedules                        Export schedules (non-widget type only).
  domain <name>                    Export the specified domain from the
                                   Automate Engine Datastore. <name> MUST
                                   be specified.
  all <target_dir>                 Export everything to target_dir

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.
  orchestration_templates          Import orchestration templates.
  reports                          Import custom reports.
  widgets                          Import custom widgets.
  policies                         Import policies.
  scanitems                        Import scan items.
  scriptsrc                        Import config script sources.
  schedules                        Import schedules (non-widget type only).
  domain <name>                    Import the specified domain from the
                                   <importsource> directory. <name> MUST
                                   be specified.
  all <source_dir>                 Import everything from source_dir

Options:
  --overwrite                      Overwites the imported domain if it
                                   already exists in the database.
                                   Only used for "domain" object type.
                                   (Default = overwrite)

  --no-overwrite                   Do NOT overwite the domain if it
                                   already exists in the database.
                                   Only used for "domain" object type.
                                   (Default = overwrite)

  --enabled                        Enables the domain after it is imported.
                                   Only used for "domain" object type.
                                   (Default = enabled)

  --disabled                       Disables the domain after it is imported.
                                   Only used for "domain" object type.
                                   (Default = enabled)

  --tenant-name=NAME               Name of the Tenant for the domain after it is
                                   imported.
                                   Only used for "domain" object type.
                                   (Default = "")

  --tenant-id=ID                   ID of the Tenant for the domain after it is
                                   imported.
                                   Only used for "domain" object type.
                                   (Default = "")

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,scanitems,scriptsrc}

cd /var/www/miq/vmdb
bin/rake rhconsulting:miq_schedules:export[${BUILDDIR}/schedules]
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:orchestration_templates:export[${BUILDDIR}/orchestration_templates]
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_scanprofiles:export[${BUILDDIR}/scanitems]
bin/rake rhconsulting:miq_scriptsrc:export[${BUILDDIR}/scriptsrc]
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:miq_schedules:import[${BUILDDIR}/schedules]
bin/rake rhconsulting:miq_scriptsrc:import[${BUILDDIR}/scriptsrc]
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:provision_dialogs:import[${BUILDDIR}/provision_dialogs]
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]
bin/rake rhconsulting:miq_scanprofiles:import[${BUILDDIR}/scanitems]
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?