< Home

ops install file

Function

The ops install file command installs a Python script.

Format

ops install file file-name [ destination directory ]

Parameters

Parameter

Description

Value

file-name

Specifies the directory and file name of the Python script to be installed.

  • To install a Python script stored in the root directory of the device, you can directly specify the file name of the script.

  • To install a Python script that is stored a non-root directory, you need to specify both the directory and file name of the script.

The value is a string of 4 to 64 case-insensitive characters without any spaces. The file name extension of a Python script file is .py.

NOTE:

file-name cannot be set to the name of a built-in Python script file, including ConfigParser.py, copy_reg.py, locale.py, sre.py, Queue.py, decimal.py, macurl2path.py, sre_compile.py, StringIO.py, dis.py, modulefinder.py, sre_constants.py, UserDict.py, dummy_thread.py, ntpath.py, sre_parse.py, UserList.py, dummy_threading.py, nturl2path.py, stat.py, UserString.py, filecmp.py, numbers.py, string.py, __future__.py, fileinput.py, opcode.py, stringold.py, _abcoll.py, fnmatch.py, os.py, struct.py, _pyio.py, formatter.py, os2emxpath.py, subprocess.py, _strptime.py, fractions.py, pickle.py, sysconfig.py, _threading_local.py, functools.py, pkgutil.py, textwrap.py, _weakrefset.py, genericpath.py, platform.py, threading.py, abc.py, getopt.py, posixpath.py, token.py, argparse.py, getpass.py, pprint.py, tokenize.py, atexit.py, gettext.py, re.py, trace.py, base64.py, glob.py, repr.py, traceback.py, bisect.py, heapq.py, runpy.py, types.py, calendar.py, imputil.py, sched.py, user.py, codecs.py, inspect.py, sets.py, warnings.py, collections.py, io.py, shutil.py, weakref.py, contextlib.py, keyword.py, site.py, xmllib.py, copy.py, linecache.py, socket.py, _cli.py, _device.py, _frame.py, _route.py, _timer.py, _common.py, _environment.py, _iclog.py, _snmp.py, _trap.py, _context.py, _farg.py, _lldp.py, _terminal.py, and ops.py.

destination directory

Specifies the installation directory of a script.

The value is a string of 1 to 64 case-insensitive characters without any spaces.

If this parameter is not specified, the script will be installed in $_user. If this parameter is specified, the script will be installed in $_user/directory. If the directory name does not exist, a directory will be created.

NOTE:

The total length of file-name and the installation directory of the script cannot exceed 118. The total length refers to the storage path + $_user + directory name + file name.

The installation directory of the script cannot be huawei_pys.

The depth of the path specified by directory cannot exceed three levels.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

OPS allows you to run the scripts you make. A script can be executed after the script assistant is configured. Before configuring a script assistant, install the script.

To check information about the scripts installed in $_user, run the dir (user view) command.

Precautions

  • Before installing a script, upload the script to the root directory of flash: on the device.
  • Ensure that the device has sufficient storage space when the script is installed. Otherwise, the script fails to be installed.
  • If the specified installation directory does not exist, a directory will be created. A maximum of seven levels of subdirectories can be created in $_user.
  • The name of the script to be installed cannot be the same as an existing directory name on the device. After scripts are installed successfully, you cannot create a directory whose name is the same as that of an installed script.
  • To install scripts in $_user, you can only run the ops install file command. The scripts installed in this directory will be automatically backed up to the standby switch when a stack is configured.
  • To modify a script that has been installed, run the ops uninstall file command to uninstall the script and the delete (user view) command to delete the script file. After modifying the script, upload and reinstalling the script file.
  • It is recommended that the total size of files installed in $_user be smaller than 100 MB. If the total size of files exceeds 100 MB, performance of data synchronization between the active and standby cards may deteriorate.

Example

# Install the script file config.py in the flash: root directory to the default flash:/$_user.

<HUAWEI> ops install file config.py

# Install the script file config.py in the flash: root directory to the specified flash:/$_user/user.

<HUAWEI> ops install file config.py destination user

# Install the script file config.py in the flash:/admin directory to the default flash:/$_user.

<HUAWEI> ops install file admin/config.py
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >